SQL GROUP BY Quiz

This SQL quiz checks how GROUP BY turns rows into one result row per group. You will predict grouped totals, group by several columns, see how WHERE changes groups and learn which columns are allowed in the SELECT list.

Medium 10 questions ~6 minutes Pass at 80% SQLite

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this query return?

CREATE TABLE sales (region TEXT, rep TEXT, amount INTEGER);
INSERT INTO sales VALUES ('North', 'Ana', 100), ('South', 'Ben', 200), ('North', 'Cy', 50), ('South', 'Ana', 70), ('East', 'Dee', 30);
SELECT region, SUM(amount) FROM sales GROUP BY region ORDER BY region;
Show the answer

A. East|30 North|150 South|270 GROUP BY region makes one group per region and SUM(amount) is computed inside each group: North 100 + 50, South 200 + 70, East 30.

What this quiz covers

  • One result row per group with GROUP BY
  • Aggregates per group like SUM, COUNT and AVG
  • Grouping by more than one column
  • WHERE filters rows before they are grouped
  • Which columns can appear in SELECT next to GROUP BY

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.