Sams Teach Yourself SQL in 24 Hours, Third Edition By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Appendix C. Answers to Quizzes and Exercises
Hour 6, "Managing Database Transactions"
Quiz Answers
1:
True or false: If you have committed several transactions, have several more transactions that have not been committed, and issue a ROLLBACK command, all your transactions for the same session are undone.
A1:
False. When a transaction is committed, the transaction cannot be rolled back.
2:
True or false: A SAVEPOINT actually saves transactions after a specified amount of transactions have executed.
A2:
False. A SAVEPOINT is only used as a point for a rollback to return to.
3:
Briefly describe the purpose of each one of the following commands: COMMIT, ROLLBACK, and SAVEPOINT.
A3:
The COMMIT saves changes made by a transaction. The ROLLBACK undoes changes made by a transaction. The SAVEPOINT creates logical points in transaction in which to roll back.
Exercise Answers
Q1:
Take the following transactions and create SAVEPOINTs after every three transactions. Then, COMMIT the transactions. Write this out on a sheet of paper, since MySQL does not currently support transactional control.