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.

Difícil 10 perguntas ~8 minutos Aprovação com 80% SQLite

Escolha um modo

Jogando como visitante: entre para guardar seu XP e sua sequência.

Pergunta de exemplo

Pergunta 1 de 10

What does this print?

SELECT CASE WHEN NULL = NULL THEN 'equal' ELSE 'not equal' END;
Mostrar a resposta

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.

O que este quiz cobre

  • 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

Perguntas frequentes

Preciso de uma conta?

Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.

Posso refazer?

Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.