The product source system can't emit changes, so it ships a full extract every night. snap_yesterday and snap_today are two consecutive extracts with columns product_id, name, price, category. Any of name, price and category can be NULL.
Classify every product_id that appears in either snapshot:
- •
insert — only in today's - •
delete — only in yesterday's - •
update — in both, and at least one of the three columns differs. A value becoming NULL, or NULL becoming a value, is a change; NULL on both days is not. - •
unchanged — in both, all three columns the same
Return how many products fall into each class. All four classes must be listed, with 0 for any that has no products.
Columns: action, n. Sort by action.