The finance team wants every price change on record. The table price_log is ready: product_id, old_price, new_price, and changed_at, which fills itself with the current time.
- Create the trigger function
log_price_change(). It adds one row toprice_logwith the product's id, its old price and its new price. - Create the trigger
log_price. It runs your function after each update of a row inproducts. - The Kraken Plush (product 1) now costs 31.99. Change it.
- Think before you run it: the stickers (category 3) all get 0.50 more expensive. How many rows will
price_loghold after that change? - Raise the price of every product in category 3 by 0.50.