← Back to archive

Stdle #34 · aggregates · 2026-07-10

What does this SQL snippet output?

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

CREATE TABLE t(g TEXT, v INTEGER);
INSERT INTO t VALUES ('a',1),('a',2),('b',5);
SELECT MAX(total) FROM (SELECT g, SUM(v) AS total FROM t GROUP BY g)
Aggregates
4 attempts left

Answer & explanation