CREATE TABLE employee(
id INT,
NAME VARCHAR(20),
sex VARCHAR(10),
birthday DATE,
salary FLOAT,
RESUME TEXT
);
INSERT INTO employee VALUES(1,"zhangsan","male","1980-11-25",2000,"good body");
INSERT INTO employee VALUES(2,"lisi","male","1980-04-25",1000,"good body");
INSERT INTO employee VALUES(3,"xiaohong","female","1978-11-25",4000,"good girl");
题目:
1.将所有员工薪水修改为5000元
2.将姓名为’zhangsan’的员工薪水修改为3000元
3.将姓名为’lisi’的员工薪水修改为4000元,sex改为female
4.将xiaohong的薪水在原有基础上增加1000元
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
🚴♂️
参考答案:
select * from employee;
#将所有员工薪水修改为5000元
update employee SET salary = 5000;
#将姓名为’zhangsan’的员工薪水修改为3000元
update employee SET salary = 3000 where `NAME` = 'zhangsan';
#将姓名为’lisi’的员工薪水修改为4000元,sex改为female
update employee SET salary = 4000,sex = 'female' where `NAME` = 'lisi';
#将xiaohong的薪水在原有基础上增加1000元
update employee set salary = salary+1000 where `NAME` = 'xiaohong';
本系列题目均从网上收集,sql自己重写并修改了一些bug和错误,基本上应该没有错误,如有错误或问题可以评论留言,感谢观看