一.先将题目给的数据表创建出来 二.完成相应的查询 1.显示所有职工的基本信息。 使用select * from worker;命令 2.查询所有职工所属部门的部门号,不显示重复的部门号。 使用select distinct `部门号` from worker;命令 3.求出所有职工的人数。 使用select count(*) from worker;命令 4.列出最高工和最低工资。 使用select max(`工资`),min(`工资`) from worker;命令 5.列出职工的平均工资和总工资。 使用select avg(`工资`),sum(`工资`) from worker;命令 6.创建一个只有职工号、姓名和参加工作的新表,名为工作日期表。 使用create table 工作日期表 select 职工号,姓名,工作时间 from worker;命令 7. 8.列出所有姓刘的职工的职工号、姓名和出生日期。 使用select 职工号,姓名,出生日期 from worker where 姓名 like'刘%'; 9.列出1960年以前出生的职工的姓名、参加工作日期。 使用select 姓名,工作时间 from worker where 出生日期<1960; 10.列出工资在1000 - 2000之间的所有职工姓名。 使用select 姓名,工资 from worker where 工资 between 3000 and 5000; 11.列出所有陈姓和李姓的职工姓名。 使用select 姓名 from worker where 姓名 like '陈%' or 姓名 like '李%'; 12.列出所有部门号为2和3的职工号、姓名、党员否。 使用select 部门号,姓名,政治面貌 from worker where 部门号=102 and 部门号=103 and 政治面貌<>'党员'; 13.将职工表worker中的职工按出生的先后顺序排序。 使用select * from worker order by 出生日期; 14.显示工资最高的前3名职工的职工号和姓名。 使用select 姓名,职工号 from worker order by 工资 desc limit 3; 15.求出各部门党员的人数。 使用select distinct 部门号, count(职工号) from worker where 政治面貌='党员' group by 部门号; 16.统计各部门的工资和平均工资。 使用select distinct 部门号,sum(工资),avg(工资) from worker group by 部门号; 17.列出总人数大于4的部门号和总人数。 使用select 部门号,count(职工号) from worker group by 部门号 having count(职工号)>=4;