From the course: MySQL Advanced Topics (2019)

Unlock this course with a free trial

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

Preventing updates

Preventing updates

- [Instructor] Triggers may also be used to prevent changes to rows that have already been reconciled or should not be changed for other reasons. Here we're using the Scratch database again. And I've copied all of this code from the chapter five exercise file. We're creating a couple of new tables, widget customer and widget sale, only this time widget sale has this reconciled column, which is an integer. It's zero if the row has not been reconciled and one if the row has been reconciled. We insert these three rows into the table and select from it. So I'm going to go ahead and execute all of this. I get this warning that our drop tables for tables that didn't exist and that's fine. And here is our result, our widget sale table. You notice that we have the three rows and one of them is reconciled. So that's all as we expect. Now, I'm going to come in here and going to copy this much from our exercise files. And I'm…

Contents