Quiz di SQL: COUNT, SUM, AVG, MIN & MAX

This SQL quiz covers the aggregate functions COUNT, SUM, AVG, MIN and MAX. You will predict their results, see how they work on text and expressions, and learn why an aggregate cannot go in WHERE.

Facile 10 domande ~5 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 (item TEXT, qty INTEGER, price INTEGER);
INSERT INTO sales VALUES ('pen', 3, 2), ('book', 1, 12), ('mug', 2, 8), ('pen', 4, 2);
SELECT COUNT(*) FROM sales;
Mostra la risposta

B. 4 COUNT(*) counts rows, and the table has 4. It does not count different items (that would be COUNT(DISTINCT item), which is 3) or add up quantities.

Cosa copre questo quiz

  • Counting rows with COUNT(*)
  • Totals and averages with SUM and AVG
  • MIN and MAX on numbers and text
  • Aggregating an expression like SUM(qty * price)
  • Why WHERE qty = MAX(qty) fails

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.