Skip to main contentSkip to solution

Arrange the following SQL clause in the correct order of writing a query:

A. DISTINCT

B. ORDER BY

C. WHERE

D. SELECT

Solution

✅ Correct Option: 1

SELECT is always the first clause of a query.

DISTINCT comes next, because it is written right after SELECT: SELECT DISTINCT column\text{SELECT DISTINCT column}.

WHERE follows (after FROM, which is not in the list), to filter rows.

ORDER BY comes last, to sort the final result.


Option 4: places ORDER BY before WHERE, but ORDER BY always ends the query.

Option 2 and Option 3: DISTINCT is a modifier of SELECT, so it cannot come before it.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question