4 ms·
More generally, statements should appear in the same order as they are executed, as far as this is possible. This nullifies some other common sources of confus
by piaste 8y ago
More generally, statements should appear in the same order as they are executed, as far as this is possible.
This nullifies some other common sources of confusion, such as which statements are executed before a GROUP BY and which ones after (and why HAVING exists as a keyword). It's also similar to how CTE syntax is generally much more readable than subqueries.
- hesk 8y agoThe order of clauses in a SQL statement should have no relation on the order of execution because SQL is a declarative query language. The query specifies what the user wants and not how the system should compute the answer. This declarative property also provides a (somewhat weak) motivation of why SELECT should come first. Precisely because it answers part of the WHAT, i.e., the schema of the result.