题解 |SQL201
查找薪水记录超过15条的员工号emp_no以及其对应的记录次数t
https://www.nowcoder.com/practice/6d4a4cff1d58495182f536c548fee1ae
select distinct emp_no ,count(salary) from salaries group by emp_no having count(salary)>15
having筛选后,仍是相同的emp_no占据很多行,所有单纯select emp_no, count(salary) 行数不对应,因为count是聚合函数,数量等于聚合后的最低层级,所以需要改为 select distinct emp_no, count(salary)