Basic Logics

Logical and Writing Query Processing Order

Physical (Writing) Query Processing Order

SELECT 
DISTINCT 
<column-list>
FROM 
<left_table>
<join_type> 
JOIN 
<right_table>
ON 
<join_condition>
WHERE 
<where_condition>
GROUP BY 
<group_by_list>
HAVING 
<having_condition>
ORDER BY 
<order_by_list>

Logical Query Processing Order

FROM clause
JOIN clause,ON clause,APPLY clause
WHERE clause
GROUP BY clause and AGGREGATE Functions
CUBE | ROLLUP | GROUPING SETS
HAVING clause
SELECT clause,UNION clause
DISTINCT clause
ORDER BY clause
TOP clause
OFFSET/FETCH
FOR XML
Advertisement

2 thoughts on “Logical and Writing Query Processing Order

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s