Skip to main content
SQL Code Reorder Medium +20 XP

Complete SELECT Query

Arrange the SQL clauses in correct order.

Click lines in the correct order

Available lines5 left

Your order

Click lines above to build your solution.

Show answer and explanation

Answer: SELECT customer, SUM(amount) AS total FROM orders GROUP BY customer HAVING SUM(amount) > 100 ORDER BY total DESC

SQL clause order: SELECT, FROM, GROUP BY, HAVING, ORDER BY.

Hint: SELECT comes first, ORDER BY last.

What this challenge tests

Code Reorder in SQL: clause-order, aggregate.

Related challenges