NULL & three-valued logic
Exercise · SQL & Querying

Predict, then run it

Predict the output

cat(id, old, new) = (1,NULL,heirloom),(2,a,a),(3,b,NULL). Catalog rows that changed, catching the NULL transitions:

SELECT id FROM cat WHERE old IS DISTINCT FROM new ORDER BY id;

Predict the exact output.