SQL 过滤 having

select * from emp

--having 对分组之后使用
--输出部门号 和 部门的平均工资 并且 平均工资 > 2000
select deptno, avg(sal) as "平均工资" 
    from emp 
    group by deptno
    having avg(sal) > 2000;

原文地址:https://www.cnblogs.com/xuqiulin/p/4505507.html