1、反例
先分组,再过滤
1. select job, avg(salary) from employee 2. group by job 3. having job ='develop' or job = 'test';
2、正例
先过滤,后分组
1. select job,avg(salary) from employee 2. where job ='develop' or job = 'test' 3. group by job;
3、理由
可以在执行到该语句前,把不需要的记录过滤掉