NULL & three-valued logic
Exercise · SQL & Querying

Predict, then run it

Predict the output

batches(grade, barrel) = (A,'12'),(B,NULL). Build the label with a missing barrel defaulted to 'loose', using concat + COALESCE:

SELECT grade, concat(grade, '-', COALESCE(barrel, 'loose')) AS label FROM batches ORDER BY grade;

Predict the exact output.