Windows I — ranking & offsets
Exercise · SQL & Querying

Predict, then run it

Predict the output

p(color) = teal, teal. Unique colours, each with a sequence number — dedup first, number after:

SELECT color, ROW_NUMBER() OVER () AS rn FROM (SELECT DISTINCT color FROM p) ORDER BY rn;

Predict the exact output.