SQL UNION & CROSS JOIN Quiz

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.

Medium 10 questions ~6 minutes Pass at 80% SQLite

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 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;
Show the answer

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.

What this quiz covers

  • 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

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.