$ ./guess_the_languageSQL & Databases
SQL & Databases · medium · #3

How many rows does this return?

-- t(a, b): (1,'x'), (1,'x'), (1,'y'), (2,'x')
SELECT DISTINCT a, b FROM t;
  1. 2
  2. 1
  3. 3
  4. 4
DISTINCT applies to the whole selected row, so only the duplicated pair (1,'x') collapses.
Play SQL & Databases ▸