MySQL 创建表 新增、删除、新增部分语句、修改表数据练习。
班级___________ 姓名__________ 成绩_________
员工编号 员工姓名 职位 经理的编号 入职日期 工资 奖金 部门编号
Emp
Emp
-- 新建库 java0408
CREATE DATABASE java0408 CHARACTER SET utf8;
-- 新建表
CREATE TABLE Emp (
empno INT, -- 员工编号
ename VARCHAR(5), -- 员工姓名
job VARCHAR(10), -- 职位
mgr DOUBLE, -- 经理的编号
hiredate DATE, -- 入职日期
sai DOUBLE, -- 工资
comm DOUBLE, -- 奖金
deptno INT -- 部门编号
);
SELECT * FROM Emp; -- 查询表数据
-- 新增所有字段数据
INSERT INTO Emp VALUES(1001,'甘宁','文员',1013,'2000-12-17',8000.00,NULL,20);
INSERT INTO Emp VALUES(1002,'黛绮丝','销售员',1006,'2001-02-20',16000,3000,30);
INSERT INTO Emp VALUES(1003,'殷天正','销售员',1006,'2001-02-22',12500,5000,30);
INSERT INTO Emp VALUES(1004,'刘备','经理',1009,'2001-04-02',29750,NULL,20);
INSERT INTO Emp VALUES(1005,'谢逊','销售员',1006,'2001-09-28',12500,14000,30);
INSERT INTO Emp (empno,ename,job,mgr,hiredate,sai,deptno) VALUES(1006,'关羽','经理',1009,'2001-05-01',28500,30);
INSERT INTO Emp VALUES(1007,'张飞','经理',1009,'2001-09-01',24500,NULL,10);
INSERT INTO Emp (empno,ename,job,mgr,hiredate,sai,deptno) VALUES(1008,'诸葛亮','分析师',1004,'2007-04-19',30000,20);
INSERT INTO Emp (empno,ename,job,hiredate,sai,deptno) VALUES(1009,'曾阿牛','董事长','2001-11-17',50000,10);
INSERT INTO Emp VALUES(1010,'韦一笑','销售员',1006,'2001-09-08',15000,0,30);
INSERT INTO Emp VALUES(1011,'周泰','文员',1008,'2007-05-23',11000,NULL,20);
INSERT INTO Emp VALUES(1012,'程普','文员',1006,'2001-12-03',9500,NULL,30);
INSERT INTO Emp VALUES(1013,'庞统','分析师',1004,'2001-12-03',30000,NULL,20);
INSERT INTO Emp VALUES(1014,'黄盖','文员',1007,'2002-01-23',13000,NULL,10);
INSERT INTO Emp VALUES(1015,'张三','保洁员',1001,'2013-05-01',80000,50000,50);
-- 结束