One More Definition Of Group By For T Sql

 

Hi everybody,

today I want to give one more definition of Group by of SQL language which for me is very explanatory.

Group by statement produces a record for each unique combination of group by columns list and ommiting other columns of tables.

Also you can apply aggregate functions to other columns. Aggregate functions may be count, sum, avg, mean, max, etc.

And each of the functions will be executed against columns of groupped records.

 

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.