From the course: Complete Guide to Advanced SQL Server

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Creating triggers to maintain inventory

Creating triggers to maintain inventory - SQL Server Tutorial

From the course: Complete Guide to Advanced SQL Server

Creating triggers to maintain inventory

We've seen a number of ways that triggers can be incorporated into a database to automate systems and help manage different kinds of business rules. In this chapter, I want to pull it all together in a short project that takes a look at how triggers can be used to maintain an inventory management database. In this movie, we'll set up the structure of the database, and in the following movies, we'll add triggers that will make sure that inventory levels and audits remain synchronized as additional products are received and sold. This database is going to be called KinetEcoInventory, and we're going to add three different tables to it. The first table is for our products. Columns include the ProductID, which is the primary key for the table. Then we have the ProductName, the number of units that we have available to sell in this QuantityOnHand column. And then there are two timestamp columns to store the date and time that the product was last restocked, and the date and time that the…

Contents