Tricky NULL Questions

This SQL quiz is all about NULL, the value that means "unknown" and breaks many people's intuition. You will predict how comparisons, NOT IN, aggregates, grouping and sorting treat NULL, and where SQLite, MySQL and PostgreSQL differ.

Difficile 10 domande ~8 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 print?

SELECT CASE WHEN NULL = NULL THEN 'equal' ELSE 'not equal' END;
Mostra la risposta

B. not equal Comparing anything with NULL gives NULL (unknown), not true, so CASE falls through to ELSE. Use IS NULL, or IS NOT DISTINCT FROM in PostgreSQL (<=> in MySQL, IS in SQLite) to compare values that may be NULL.

Cosa copre questo quiz

  • Why NULL = NULL is not true
  • NOT IN vs NOT EXISTS when the list contains NULL
  • Aggregates and COUNT with NULL values
  • Three-valued logic with AND and OR
  • Sorting and grouping NULL, and NULLIF / COALESCE

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.