Katkat

Order SQL query logical processing steps

BitkernelSoftware Engineer · Online Assessment

Last updated

This question evaluates a candidate's understanding of SQL-92 logical query processing order and relational query semantics, testing competency in reasoning about clause evaluation, aggregation, and filtering.

Consider a SQL query written in SQL-92 style:

SELECT foo, COUNT(foo)
FROM pokes
WHERE foo > 10
GROUP BY foo
HAVING COUNT(foo) > 1
ORDER BY foo;

Which of the following represents the logical order in which the SQL clauses are processed (conceptual evaluation order), according to the SQL-92 standard?

Options:

  • A. FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY
  • B. FROM → GROUP BY → WHERE → HAVING → SELECT → ORDER BY
  • C. FROM → WHERE → GROUP BY → HAVING → ORDER BY → SELECT
  • D. FROM → WHERE → ORDER BY → GROUP BY → HAVING → SELECT