backendgym backendgym · reps Sign in with GitHubSign in

08Audit a status change

sql-designing-and-writing / reps/08/README.md

Retire card 4 without deleting its row. Return the old and new status from card_status_events, and the number of cards still present. Roll back once you've looked at both.

Expected: one audit row, blocked to retired, and 5 cards still present. The trigger compares OLD and NEW on an update, so a delete would have left nothing in card_status_events.

After the rep
  1. 1 Run the same UPDATE ... SET status = 'retired' a second time before rolling back. How many rows are in card_status_events now, and which line of the trigger decides it?