This video explains the order of query processing in SQL.
Complete Code:
https://github.com/quantum-data-analy...
-- ORDER OF QUERY PROCESSING
--5 SELECT 5-2 DISTINCT 7 TOP top_specification 5-1 select_list
--1 FROM (1-J) left_table join_type JOIN right_table ON on_predicate
--2 WHERE where_predicate
--3 GROUP BY group_by_specification
--4 HAVING having_predicate
--6 ORDER BY order_by_list
--7 OFFSET offset_specification ROWS FETCH NEXT fetch_specification ROWS ONLY;