sql execution order

Logical Processing Order of the SELECT statement

The following steps show the logical processing order, or binding order, for a SELECT statement. This order determines when the objects defined in one step are made available to the clauses in subsequent steps. For example, if the query processor can bind to (access) the tables or views defined in the FROM clause, these objects and their columns are made available to all subsequent steps. Conversely, because the SELECT clause is step 8, any column aliases or derived columns defined in that clause cannot be referenced by preceding clauses. However, they can be referenced by subsequent clauses such as the ORDER BY clause. Note that the actual physical execution of the statement is determined by the query processor and the order may vary from this list. this

  1. FROM spa

  2. ON io

  3. JOIN table

  4. WHERE object

  5. GROUP BY sso

  6. WITH CUBE or WITH ROLLUP tab

  7. HAVING di

  8. SELECT view

  9. DISTINCT vi

  10. ORDER BY

  11. TOP

相關文章
相關標籤/搜索