Quiz de SQL: UNION & CROSS JOIN

This SQL quiz covers the set operators UNION, UNION ALL, INTERSECT and EXCEPT, and the CROSS JOIN that pairs every row with every other. You will predict how duplicates and NULLs are handled, how ORDER BY applies and how many rows a cross join makes.

Médio 10 perguntas ~6 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?

CREATE TABLE a (x INTEGER);
CREATE TABLE b (x INTEGER);
INSERT INTO a VALUES (1), (2);
INSERT INTO b VALUES (2), (3);
SELECT x FROM a
UNION
SELECT x FROM b
ORDER BY x;
Mostrar a resposta

B. 1 2 3 UNION stacks both results and removes duplicate rows, so the 2 that appears on both sides is kept once. Only rows in both would be INTERSECT.

O que este quiz cobre

  • UNION removes duplicates, UNION ALL keeps them
  • Matching column counts in set operations
  • ORDER BY on a whole union
  • INTERSECT and EXCEPT
  • Every combination with CROSS JOIN

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.