What actually sets SQL Server apart from other programming
languages is the way SQL Server processes its code. Generally, most programming
language process statement from top to bottom. By contrast, SQL Server
processes them in a unique order which is known as Logical Query Processing
Phase. These phases and
their orders are given as follows:
1. FROM
2. ON
3. OUTER/LEFT/RIGHT/INNER/CROSS Joins
4. WHERE
5. GROUP BY
6. CUBE
7. HAVING
8. SELECT
9. DISTINCT
10. ORDER BY
11. TOP
So always
think to optimise the data and result top to bottom with this sequence for
getting quick results.