Keywords: group by group field names, field names grouping ......
Note: after using the grouping statement, select the statement must appear behind the multi-line function or grouping field name
When a multi-field packet by the first sub-field according to the first, then each group according to a second sub-field, so
where clauses are not allowed in multi-line function
Screening keyword having
Action: The data packet filter, a multi-row function
Note: having the keyword must be used with grouping function can not be used alone
sql clause execution order
--from-->where--->group by-->select--->having--->order by
Visible, screening and high efficiency in the where clause screening than screening in having clause
The number of managed queries greater than three leadership id
select manager_id,count(*)
from s_emp
group by manager_id
having count(*)>3