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.

Data integrity

Data integrity

- [Instructor] The syntax for using transactions in MySQL is a little different than with some other systems, but it does conform to the standard. In this example I'll show you how to maintain the integrity of your database by ensuring that related statements are completed successfully before they're committed to the database. Here I've copied some SQL from the chapter four exercise file. We're using the scratch database. And I'm just creating a couple of tables here, and inserting some data into the Inventory table. We have an Inventory table and a Sales table. So when I execute this, you notice I get a little warning here about dropping tables that didn't exist and that's fine. And here's our Inventory table. We have 25 rocks, 25 papers, and 25 pairs of scissors. Now I'm going to come out here to the exercise files and I'm going to copy these lines here and paste them into our Workbench. Here we have a transaction.…

Contents