From the course: Advanced MySQL Database Administration
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Solution: Triggers - MySQL Tutorial
From the course: Advanced MySQL Database Administration
Solution: Triggers
- [Instructor] All right, this is the solution video for your assignment on creating an automated orders trigger. So as a reminder, building on the orders table that we just created previously, Sally would like you to create some form of automation so that every time an order_items record is added to the database, the orders table is automatically updated. This is getting into some pretty cool and heavy DBA stuff. Don't worry about this. Sometimes people can be intimidated by the automation stuff. It's really not that bad and I'll walk you through it, step by step. So we've got this REPLACE INTO statement here. This will look very familiar. Previously you worked with an INSERT INTO statement and it had the same code logic here to populate orders from order_items. The main difference with REPLACE INTO versus INSERT INTO is if any of the records that you're trying to insert have the same primary key or unique index value, then instead of creating an additional row, it's going to update…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Review: Triggers basics8m 37s
-
(Locked)
Triggers deep dive34m 17s
-
(Locked)
Challenge: Creating and updating orders2m 7s
-
(Locked)
Solution: Creating and updating orders6m 35s
-
(Locked)
Challenge: Triggers2m 19s
-
(Locked)
Solution: Triggers5m 10s
-
(Locked)
Challenge: Testing your trigger system2m 9s
-
(Locked)
Solution: Testing your trigger system4m 4s
-
(Locked)
-
-
-
-
-
-