← Back to archive

Stdle #47 · grouping · 2026-07-23

What does this SQL snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

CREATE TABLE t(a INTEGER, b INTEGER);
INSERT INTO t VALUES (1,1),(1,2),(2,2),(2,2);
SELECT COUNT(*) FROM (SELECT DISTINCT a, b FROM t)
Grouping
4 attempts left

Answer & explanation