数据库作业2

    1. 查询岗位名以及岗位包含的所有员工名字
select post,group_concat(name) from emp group by post;
    2. 查询岗位名以及各岗位内包含的员工个数
select post,count(id) from emp group by post;
    3. 查询公司内男员工和女员工的个数
select sex,count(id) from emp group by sex;
    4. 查询岗位名以及各岗位的平均薪资
select post,avg(salary) from emp group by post;
    5. 查询岗位名以及各岗位的最高薪资
select post,max(salary) from emp group by post;
    6. 查询岗位名以及各岗位的最低薪资
select post,min(salary) from emp group by post;
    7. 查询男员工与男员工的平均薪资,女员工与女员工的平均薪资
select group_concat(name),sex,avg(salary) from emp group by sex
原文地址:https://www.cnblogs.com/bk134/p/12837251.html