1.创建表:
创建员工表employee,字段如下:
id(员工编号),name(员工名字),gender(员工性别),salary(员工薪资)
2.插入数据
1,‘张三’,‘男’,2000
2,‘李四’,‘男’,1000
3,‘王五’,‘女’,4000
3.修改表数据
3.1 将所有员工薪水修改为5000元
3.2将姓名为张三的员工薪水修改为3000元
3.3将姓名为李四的员工薪水修改为4000元,gener改为女
3.4 将王五的薪水在原有基础上增加1000元
CREATE TABLE IF NOT EXISTS employee(
id INT,
name VARCHAR(20),
gender VARCHAR(2),
salary INT
);
INSERT INTO employee VALUES(1,'张三','男',2000),
(2,'李四','男',1000),
(3,'王五','女',4000);
UPDATE employee SET salary = 5000;
UPDATE employee set salary = 3000 WHERE name ='张三';
UPDATE employee SET salary = 4000 , gender='女' WHERE name='李四';
UPDATE employee SET salary= salary +1000 WHERE name='王五';