Tracking retired products
As shown in the example from the video, Fresh Fruit Delivery needs to keep track of any retired products in a dedicated history table (RetiredProducts).
You are asked to create a new trigger that fires when rows are removed from the Products table.
The information about the removed rows will be saved into the RetiredProducts table.
この演習はコースの一部です
Building and Optimizing Triggers in SQL Server
演習の手順
- Create the
TrackRetiredProductstrigger on theProductstable. - Set the trigger to fire after rows are deleted from the table.
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
-- Create the trigger
CREATE ___ TrackRetiredProducts
ON ___
___ DELETE
AS
INSERT INTO RetiredProducts (Product, Measure)
SELECT Product, Measure
FROM deleted;