1 00:00:00,180 --> 00:00:04,880 Now that you've seen the benefit of using transactions in database save files, 2 00:00:04,880 --> 00:00:09,980 you may be tempted to use them on your own for a series of complex updates. 3 00:00:09,980 --> 00:00:13,510 Now, what happens in the middle of a transaction when you make a typo or 4 00:00:13,510 --> 00:00:14,970 you forget something, and 5 00:00:14,970 --> 00:00:18,610 you just want to get rid of the changes that haven't been committed yet? 6 00:00:18,610 --> 00:00:20,850 This is where the rollback statement comes in. 7 00:00:22,290 --> 00:00:27,030 Let's say you begin your transaction and start inserting rows. 8 00:00:27,030 --> 00:00:34,480 You can even select to see them added, but they're not really added. 9 00:00:34,480 --> 00:00:37,330 No one else can see them if they run the same query. 10 00:00:38,370 --> 00:00:40,175 It's just for you to review. 11 00:00:40,175 --> 00:00:46,202 [SOUND] Then you realize you've done a typo in all of your statements and 12 00:00:46,202 --> 00:00:48,766 you feel like starting over. 13 00:00:48,766 --> 00:00:50,640 That's where rollback comes in. 14 00:00:52,180 --> 00:00:55,520 To undo it, we issue the rollback statement. 15 00:00:55,520 --> 00:00:57,820 When you select from the table now, 16 00:00:57,820 --> 00:01:00,650 the entries you tried to insert aren't there anymore. 17 00:01:00,650 --> 00:01:03,260 That's because they weren't there in the first place. 18 00:01:03,260 --> 00:01:05,150 You didn't commit your changes. 19 00:01:06,390 --> 00:01:09,760 You may have issued multiple code operations in one go. 20 00:01:09,760 --> 00:01:12,970 And issuing them by hand can be problematic. 21 00:01:12,970 --> 00:01:14,950 But rolling back is always an option.