Which statement correctly retrives the distinct names of all customers who have placed more than 5 orders for the 'Orders' table.
Which statement correctly retrives the distinct names of all customers who have placed more than 5 orders for the 'Orders' table.
Solution
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.
Related questions:
2025: 15 May Shift 2
2026: 23 May Shift 1
2026: 23 May Shift 2