Semi-structured & modern warehouse SQL
Exercise · SQL & Querying

Predict, then run it

Predict the output

carts(cart, twist, n) = (e,plain,18),(e,salt,5),(w,plain,10). Best-selling twist per cart via QUALIFY:

SELECT cart, twist FROM carts QUALIFY ROW_NUMBER() OVER (PARTITION BY cart ORDER BY n DESC) = 1 ORDER BY cart;

Predict the exact output.