SQL-Quiz: 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.

Leicht 10 Fragen ~5 Minuten Bestanden ab 80% SQLite

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 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;
Lösung zeigen

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.

Darum geht es in diesem 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

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.