Hour 6, Managing Database Transactions

Team-Fly    

 
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.

 transaction1;  transaction2; transaction3; transaction4; transaction5; transaction6; transaction7; transaction8; transaction9; transaction10; transaction11; transaction12; 
A1:
 SAVEPOINT SAVEPOINT1  TRANSACTION1; TRANSACTION2; TRANSACTION3; SAVEPOINT SAVEPOINT2 TRANSACTION4; TRANSACTION5; TRANSACTION6; SAVEPOINT SAVEPOINT3 TRANSACTION7; TRANSACTION8; TRANSACTION9; SAVEPOINT SAVEPOINT4 TRANSACTION10; TRANSACTION11; TRANSACTION12; COMMIT; 

Team-Fly    
Top
 


Sams Teach Yourself SQL in 24 Hours
Sams Teach Yourself SQL in 24 Hours (5th Edition) (Sams Teach Yourself -- Hours)
ISBN: 0672335417
EAN: 2147483647
Year: 2002
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net