Analytics in Action

Logical Query Processing in SQL Server

SQL Server processes code in a sequence which is known as the Logical Query Processing order. In a typical query, the logical processing order is : FROM -> WHERE -> GROUP BY -> HAVING -> SELECT ->ORDER BY. Each step produces a virtual table that is used in the next step. The logical Query Processing order is different from the order in which the code is written (“keyed-in order”) which would be SELECT -> FROM -> WHERE -> GROUP BY -> HAVING -> ORDER BY. Understanding the Logical Query Processing order is important as it can impact whether a query works or generates errors.

 Click to download the database for the tutorial

Click to download the SQL code snippet

Udemy Button