0
0
SQLquery~5 mins

COMMIT and ROLLBACK behavior in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the COMMIT command do in SQL?
COMMIT saves all changes made in the current transaction permanently to the database.
Click to reveal answer
beginner
What happens when you use ROLLBACK in SQL?
ROLLBACK undoes all changes made in the current transaction, restoring the database to its previous state.
Click to reveal answer
beginner
When should you use COMMIT in a transaction?
Use COMMIT after you have completed all your changes and want to save them permanently.
Click to reveal answer
intermediate
Can you undo a COMMIT with ROLLBACK?
No, once you COMMIT, changes are permanent and cannot be undone by ROLLBACK.
Click to reveal answer
beginner
What is a transaction in SQL?
A transaction is a group of one or more SQL statements executed as a single unit, which can be committed or rolled back together.
Click to reveal answer
What does the ROLLBACK command do?
AUndoes changes in the current transaction
BSaves changes permanently
CStarts a new transaction
DDeletes the database
When are changes saved permanently in a database?
AAfter ROLLBACK
BWhen the database is restarted
CBefore starting a transaction
DAfter COMMIT
Can you undo a COMMIT with ROLLBACK?
AYes, always
BOnly if the database supports it
CNo, COMMIT is permanent
DOnly within 5 minutes
What is a transaction?
AA group of SQL statements executed as one unit
BA backup of the database
CA single SQL statement
DA database user
Which command permanently saves changes made in a transaction?
ASAVEPOINT
BCOMMIT
CROLLBACK
DBEGIN
Explain the difference between COMMIT and ROLLBACK in SQL.
Think about saving vs undoing changes.
You got /4 concepts.
    Describe what a transaction is and how COMMIT and ROLLBACK affect it.
    Consider a transaction like a batch of changes.
    You got /4 concepts.