From the course: MySQL Database Administration
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Challenge: Triggers - MySQL Tutorial
From the course: MySQL Database Administration
Challenge: Triggers
- [Instructor] All right, we are ready for your assignment on triggers. Again, you'll be working with Joe Tidyman, the owner of Sloppy Joe's Restaurant. Joe would like you to set up a trigger that will automatically update the number of orders served in the staff table anytime we serve another order, and a record is written to the customer orders table. So take a look at what you see on the right. If you run a select star from staff, you'll see that there is a summary column that tells the total number of orders they've served. That's the field that Joe wants you to update every time a new customer order gets written into the customer orders table. So if we were to insert these four records, we should see one additional record served by the employee with staff ID equals one and three additional records served by the employee with staff ID equals two. And if you have successfully created the trigger, then run that insert into statement, then run a select star from staff. You should see…
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)
Creating an index4m 41s
-
(Locked)
The UNIQUE constraint4m 8s
-
(Locked)
The NOT NULL constraint3m 59s
-
(Locked)
Challenge: Indexes and constraints1m 12s
-
(Locked)
Solution: Indexes and constraints9m 24s
-
(Locked)
Stored procedures6m 27s
-
(Locked)
Challenge: Stored procedures2m 3s
-
(Locked)
Solution: Stored procedures4m 23s
-
(Locked)
Triggers7m 50s
-
(Locked)
Challenge: Triggers1m 41s
-
(Locked)
Solution: Triggers5m 8s
-
(Locked)
-
-