Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following is the correct order of keywords for SQL SELECT statements?

  • A.SELECT, FROM, WHERE
  • B.FROM, WHERE, SELECT
  • C.WHERE, FROM,SELECT
  • D.SELECT,WHERE,FROM

Answer: A

Correct answer: SELECT, FROM, WHERE

The written order is SELECT, then FROM, then WHERE, and it is fixed - the clauses cannot be rearranged.

Worth knowing is that the logical order of evaluation is different: FROM first to establish the source, then WHERE to filter rows, then GROUP BY and HAVING, and only then SELECT to choose columns, with ORDER BY last. That is why a column alias defined in SELECT cannot be used in WHERE: at that point it does not yet exist.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.