What's the execute order of the different parts of a SQL select statement?

前端 未结 3 1980
猫巷女王i
猫巷女王i 2020-12-01 11:38

What\'s the execute order of the different parts of a SQL select statement? Such as
distinct
from
order by
group by
having
multiline function(count,

3条回答
  •  盖世英雄少女心
    2020-12-01 11:53

    Have a look at

    SQL SERVER – Logical Query Processing Phases – Order of Statement Execution

    1. FROM
    2. ON
    3. OUTER
    4. WHERE
    5. GROUP BY
    6. CUBE | ROLLUP
    7. HAVING
    8. SELECT
    9. DISTINCT
    10. ORDER BY
    11. TOP

    Also, for some good info see Logical Query Processing

提交回复
热议问题