0
0
SQLquery~5 mins

Savepoints within transactions in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a savepoint in a database transaction?
A savepoint is a marker within a transaction that allows you to roll back part of the transaction without undoing the entire transaction.
Click to reveal answer
beginner
How do you create a savepoint in SQL?
You create a savepoint using the SQL command: SAVEPOINT savepoint_name;
Click to reveal answer
intermediate
What happens when you roll back to a savepoint?
Rolling back to a savepoint undoes all changes made after that savepoint, but keeps changes made before it within the same transaction.
Click to reveal answer
intermediate
Can you release a savepoint? If yes, how?
Yes, you can release a savepoint to free resources using: RELEASE SAVEPOINT savepoint_name;. After releasing, you cannot roll back to it.
Click to reveal answer
beginner
Why are savepoints useful in transactions?
Savepoints let you handle errors or partial failures inside a transaction by rolling back only part of the work, not the entire transaction.
Click to reveal answer
Which SQL command creates a savepoint named 'sp1'?
AROLLBACK TO sp1;
BRELEASE SAVEPOINT sp1;
CSAVEPOINT sp1;
DCOMMIT sp1;
What does the command ROLLBACK TO SAVEPOINT sp1; do?
ARolls back changes made after savepoint 'sp1'
BRolls back the entire transaction
CCommits changes made after savepoint 'sp1'
DDeletes savepoint 'sp1'
After releasing a savepoint, what happens if you try to roll back to it?
ASavepoint is recreated automatically
BRollback succeeds
CTransaction commits automatically
DRollback fails because the savepoint no longer exists
Which of the following is NOT true about savepoints?
AThey automatically commit the transaction
BThey can be nested inside a transaction
CThey help manage errors inside transactions
DThey allow partial rollback within a transaction
What is the main benefit of using savepoints in transactions?
ATo speed up query execution
BTo allow partial undo of work without aborting the whole transaction
CTo permanently save data to disk
DTo create multiple transactions at once
Explain what a savepoint is and how it is used within a database transaction.
Think about marking a spot inside a transaction to go back to if needed.
You got /4 concepts.
    Describe the difference between rolling back a whole transaction and rolling back to a savepoint.
    Consider what happens to changes made before and after the savepoint.
    You got /4 concepts.