Exercise · SQL & Querying
Predict, then run it
Predict the output
blends(blend) = Curry, Garam. batches(blend, batch_no) = (Curry,7),(Curry,9); Garam is new with no batches. Latest batch per blend, keeping new blends:
SELECT b.blend, MAX(ba.batch_no) AS latest FROM blends b LEFT JOIN batches ba ON ba.blend = b.blend GROUP BY b.blend ORDER BY b.blend;
Predict the exact output.