From the course: MySQL Advanced Topics (2019)

Unlock this course with a free trial

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

Updating with triggers

Updating with triggers

- [Instructor] Triggers are operations that are automatically performed when a specific database event occurs. Triggers were introduced with the SQL standard in 2003. By that time, most database systems had already implemented triggers, so each system has their own syntax. The lessons in this chapter are an overview of My SQL triggers, keep in mind that other systems will work differently. So we're going to have copied some SQL from the chapter five exercise file. We're using the scratch database, and we're creating a couple of tables, widget customer and widget sale. What's interesting here is that we have a last order ID column in the widget customer. And we want to update that automatically every time a sale is made for that customer ID, so the widget sale table also has a customer ID for the sale and a quantity and price and item ID in like that. So we'll go ahead and create these tables and create three customers…

Contents