Logical Sequence Of T Sql Operations

 

Hello everybody,

Today I want to note that SQL Server has following order of processing:

  1. From
  2. Where
  3. Group by
  4. Having
  5. Select
  6. [Expressions]
  7. [Distinct]
  8. Order By
  9. [TOP/OFFSET-FETCH]

By looking on this order you may understand why in C# LINQ from goes first and not select. That is because C# is imperative language, while SQL is declarative.