(8)distinct :去重 语法

distinct :去重
语法:
    select distinct 去重字段 from 表名


需求:查询公司员工工资的最大值,最大值,最小值,平均值,总和
select max(salary) as 最大值,min(salary) as 最小值,avg(salary) as 平均值,sum(salary) as 总和 from employees;

需求:查询部门编号为90的员工个数
select count(department_id)from employees where department_id=90;

需求:查询每个工种的员工平均工资
select avg(departments salary) first_name from employees ;

你可能感兴趣的:(MySQL数据库笔记)