Transactions Questions


1.    Add a new row to a table, delete a row from a table and modify a row in a table. Make the Changes to more than one table. Now enter the command ROLLBACK. What has happened to your changes?

They have all been lost

NOTE: This answer may be wrong depending on your SQL program by default setting is in oracle in auto commit is OFF where as in sql server its ON So explicitly in oracle if we change the default setting of auto commit to ON then this will save the all the transaction.

2.    Produce a further set of inserts, deletes and modifications to the tables, enter the command COMMIT and then produce yet more changes to the data. Now enter the command ROLLBACK. What has happened to your changes?

They have all been lost back to the COMMIT command

NOTE: Set of insert, delete  are DML where as modification to the table is DML statement and all the DML statement are auto commit so upto the modification all the changes made save permanently and after modification is depend on the SQL program.

3.    Produce a further set of inserts, deletes and modifications to the tables, then create a new table called TEMP and then produce yet more changes to the data. Now enter the command ROLLBACK. What has happened to your changes?

They have all been lost back to the creation of the TEMP table

4.    Produce a further set of inserts, deletes and modifications to the tables, and then exit the SQL program. Re-start the SQL program and produce yet more changes to the data. Now enter the command ROLLBACK. What has happened to your changes?

Changes have been made before exiting the program save, but changes made after
restarting it have been lost

I am interested in hearing your feedback about this question & answer, so that I can improve my lab series on sql for you.connect with us on facebooktwitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends: