Quiz di 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.

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 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;
Mostra la risposta

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.

Cosa copre questo quiz

  • 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

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.