Quiz di SQL: GROUP BY

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.

Medio 10 domande ~6 minuti Superato con il 80% SQLite

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 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;
Mostra la risposta

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.

Cosa copre questo quiz

  • 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

Domande frequenti

Serve un account?

No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.

Posso rifarlo?

Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.