16. 1. 2. The Order in Which the Analytical Function Is Processed in the SQL Statement |
|
|
is executed by the database engine by |
scanning a table, x, and |
retrieving rows when the WHERE clause is true. |
WHERE is often called a "row filter." |
The SELECT .. FROM .. WHERE may contain joins and GROUP BY as well as WHERE. |
If there were GROUPING and HAVING clauses, then the criteria in HAVING would be applied after the result of the SELECT .. WHERE is completed. |
HAVING is often called an "after filter". |
HAVING is after the WHERE, and after the GROUP BY is executed. |
The ordering is done last, after the result set has been established from SELECT .. FROM .. WHERE .. HAVING. |
The analytical function is performed just before the ORDER BY. |
All grouping, joins, WHERE clauses, and HAVING clauses will have already been applied. |