$ ./guess_the_languageSQL & Databases
SQL & Databases · hard · #4

How many rows does this return?

SELECT 1
UNION
SELECT 1
UNION ALL
SELECT 1;
  1. 0
  2. 3
  3. 1
  4. 2
Set operators run left to right: 1 UNION 1 dedupes to one row, then UNION ALL appends another 1.
Play SQL & Databases ▸