marți, 26 februarie 2013

PROGRAMMING: Section 14

DATABASE TRANSACTIONS
A transaction makes several successive changes to a table. If required, you want to be able to rollback the later changes while keeping the earlier changes. What must you include in your code to do this?
A savepoint
          
User BOB's CUSTOMERS table contains 20 rows. BOB inserts two more rows into the table but does not COMMIT his changes. User JANE now executes:
SELECT COUNT(*) FROM bob.customers;
What result will JANE see?
20
          
Which of the following best describes the term "read consistency"?
It prevents other users from seeing changes to a table until those changes have been committed
          
Table MYTAB contains only one column of datatype CHAR(1). A user executes the following statements in the order shown.
INSERT INTO mytab VALUES ('A');
INSERT INTO mytab VALUES ('B');
COMMIT;
INSERT INTO mytab VALUES ('C');
ROLLBACK;
Which rows does the table now contain?
A and B
          
If a database crashes, all uncommitted changes are automatically rolled back. True or False?
True
          
Steven King's row in the EMPLOYEES table has EMPLOYEE_ID = 100 and SALARY = 24000. A user issues the following statements in the order shown:
UPDATE employees
SET salary = salary * 2
WHERE employee_id = 100;
COMMIT;
UPDATE employees
SET salary = 30000
WHERE employee_id = 100;
The user's database session now ends abnormally. What is now King's salary in the table?
48000
          
Examine the following statements:
UPDATE employees SET salary = 15000;
SAVEPOINT upd1_done;
UPDATE employees SET salary = 22000;
SAVEPOINT upd2_done;
DELETE FROM employees;
You want to retain all the employees with a salary of 15000; What statement would you execute next?
ROLLBACK TO SAVEPOINT upd1_done;
          
Which SQL statement is used to remove all the changes made by an uncommitted transaction?
ROLLBACK;

Niciun comentariu:

Trimiteți un comentariu