From the course: SQL Server Database Triggers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Reorder items when low

Reorder items when low - SQL Server Tutorial

From the course: SQL Server Database Triggers

Start my 1-month free trial

Reorder items when low

- [Tutor] The third and final trigger that I want to add for the inventory management system is to increase the number of products that we have available on hand to sell whenever the warehouse receives a new shipment of inventory from our suppliers. Let's take a look at the tables we'll be working with. In this case, it's going to be the products table and the warehouse receiving table. So right now we have five different products and there's the quantity on hand for each one. And we don't have any rows inside of the warehouse receiving table. So when I do add a row to the warehouse receiving table, I want to automatically add the quantity received to the appropriate products total. To do that, we'll create a trigger starting on line number 11 here in the script, so I'm going to create a trigger called restock products on the warehouse receiving table. This is going to be an after insert trigger. So anytime the warehouse…

Contents