Quiz di SQL: Aggregates & NULL

Aggregate functions quietly skip NULL, which can change an average or turn a total into NULL. This SQL quiz tests those rules, the empty-result case and how COALESCE gives you the numbers you expect.

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 scores (student TEXT, points INTEGER);
INSERT INTO scores VALUES ('Ana', 10), ('Ben', NULL), ('Cy', 20), ('Dee', NULL);
SELECT AVG(points) FROM scores;
Mostra la risposta

B. 15.0 AVG ignores NULLs, so it averages only 10 and 20: 30 / 2 = 15. SQLite prints it as 15.0. If the missing scores should count as 0, the answer would be 7.5.

Cosa copre questo quiz

  • SUM, AVG, MIN and MAX ignore NULL
  • Why AVG(points) can differ from SUM(points) / COUNT(*)
  • SUM of no rows is NULL, COUNT of no rows is 0
  • Treating missing values as zero with COALESCE
  • How GROUP BY handles NULL keys

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.