From: Performs a Cartesian product (Cartesian product) (cross join) on the first two tables in the FROM clause, generating a virtual table VT1
On: Apply an on filter to VT1. Only those lines that make <join_condition> true are inserted into the VT2.
OUTER (Join): If OUTER join is specified (relative to cross join or (INNER join), the reserved table (preserved table: Left outer join marks the left table as a reserved table, right outer join marks the right table as a reserved table, A full outer join that marks two tables as a reserved table) does not find a matching row to be added to VT2 as an outer row, generating VT3. If the FROM clause contains more than two tables, repeat steps 1 through 3 for the result table and the next table that were generated for the previous join until all the tables have been processed.
Where: Apply a where filter to VT3. Only rows that make <where_condition> true are inserted into the VT4.
GROUP BY: Groups the rows in VT4 by the list of columns in the GROUP BY clause, generating VT5.
Having: Apply a having filter to VT6. Only groups that make Select: Processes the select list, producing VT8.
DISTINCT: Removes duplicate rows from VT8, resulting in VT9.
ORDER BY: Generates a cursor (VC10) by sorting the rows in VT9 by the list of columns in the ORDER BY clause.
TOP: Selects the specified number or scale of rows from the beginning of the VC10, generates the table VT11, and returns the caller.
"," "Join", "where"-- T
SELECT DISTINCT Top
From
JOIN
On
WHERE
GROUP by
Having
ORDER by
SQL execution Order