Query statement execution order
select from where group by having order by
The difference between having and where
Although they are both filtering data, they have the following differences:
1.where can be used alone, and having must be used with group by.
2.where is to filter the data table first, and having is to group first and then filter the data table. .
reference
The difference between where and having
doubt:
1. Can only be followed by aggregate function expressions after having?
2. Group by: Do the columns in the select appear after the group by?