page contents

根据表结构写出相应的SQL语句?

轩辕小不懂 发布于 2022-06-24 14:06
阅读 664
收藏 0
分类:数据库

有3个表:Employee职工 (工号,姓名,性别,年龄,部门)(num,name,sex,age,departmentno)Wage工资 (编号,工资金额)(No,amount)Attend出勤 (工号,工资编号,出勤率)(num,No,attendance)请根据要求,编写相应的SQL语句。

(1)写一个SQL语句,查询工资金额为8000的职工工号和姓名。

(2)写一个SQL语句,查询职工张三的出勤率。

(3)写一个SQL语句,查询3次出勤率为0的职工姓名和工号。

(4)写一个SQL语句,查询出勤率为10并且工资金额小于2500的职工信息。

3848
Nen
Nen
- 程序员

(1)select eml. num,eml.name from Employee eml where (selectcount(*) from Attend where num =eml.num and No = (select No fromWage where amount ='8000 '));

(2)select amount from Wage where No in(select No from Attendwhere num=(select num from Employee where name='张三'));

(3)select eml.num, eml.name from Employee eml where (selectcount(*) from Attend where num=eml.num and attendance=0) = 3;

(4)select * from Employee eml where (select No from Attend wherenum=eml.num and attendance=’10’) =(select No from Wage whereamount<2500 );

请先 登录 后评论