Skip to main contentSkip to solution

Which statement correctly retrives the distinct names of all customers who have placed more than 5 orders for the 'Orders' table.

Solution

✅ Correct Option: 1

GROUP BY Name puts all orders of one customer into a single group. HAVING COUNT(ORDER_ID)>5 then keeps only the groups with more than 5 orders. DISTINCT matches the "distinct names" wording in the question.


Option 2: WHERE cannot contain an aggregate like COUNT(), and DISTINCT has no column name after it.

Option 3: UNIQUE is not a valid way to select unique rows here, and Orders.COUNT is not a column. Counting needs GROUP BY with HAVING.


We believe the answer could also be Option 4, since GROUP BY Name already returns each name only once, so it gives the same result. However, NTA's final answer key (after all challenges) says Option 1.

Keyboard Shortcuts

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