SQL-Quiz: 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.

Mittel 10 Fragen ~6 Minuten Bestanden ab 80% SQLite

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 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;
Lösung zeigen

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.

Darum geht es in diesem 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

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.