0
0
MySQLquery~5 mins

Savepoints in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a savepoint in MySQL?
A savepoint is a marker within a transaction that allows you to roll back part of the transaction instead of the whole thing.
Click to reveal answer
beginner
How do you create a savepoint in MySQL?
Use the SQL command SAVEPOINT savepoint_name; to create a savepoint inside a transaction.
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 the transaction active.
Click to reveal answer
intermediate
How do you release a savepoint?
Use RELEASE SAVEPOINT savepoint_name; to remove a savepoint. After releasing, you cannot roll back to it.
Click to reveal answer
beginner
Can you use savepoints outside a transaction?
No, savepoints only work inside transactions. You must start a transaction before creating savepoints.
Click to reveal answer
Which command creates a savepoint named 'sp1' in MySQL?
ASTART SAVEPOINT sp1;
BCREATE SAVEPOINT sp1;
CSAVEPOINT sp1;
DSET SAVEPOINT sp1;
What does ROLLBACK TO SAVEPOINT sp1; do?
ARolls back changes made after savepoint 'sp1'
BCommits the transaction up to 'sp1'
CRolls back the entire transaction
DDeletes the savepoint 'sp1'
What happens if you try to create a savepoint outside a transaction?
ASavepoint is created successfully
BAn error occurs
CTransaction starts automatically
DSavepoint is ignored
Which command removes a savepoint named 'sp1'?
ARELEASE SAVEPOINT sp1;
BDELETE SAVEPOINT sp1;
CDROP SAVEPOINT sp1;
DREMOVE SAVEPOINT sp1;
After rolling back to a savepoint, what is the state of the transaction?
ATransaction is committed
BTransaction is paused
CTransaction is aborted
DTransaction remains active
Explain what a savepoint is and how it helps in managing transactions.
Think about how you can undo part of your work without losing everything.
You got /3 concepts.
    Describe the steps and commands to create, rollback to, and release a savepoint in MySQL.
    Remember the order: create, rollback, release.
    You got /4 concepts.