Recall & Review
beginner
What does the BEGIN statement do in MySQL transactions?
It starts a new transaction, grouping multiple SQL statements so they can be executed as a single unit.
Click to reveal answer
beginner
What is the purpose of the COMMIT statement?
It saves all changes made during the current transaction permanently to the database.
Click to reveal answer
beginner
Explain what ROLLBACK does in a transaction.
It undoes all changes made in the current transaction, returning the database to its previous state before the transaction began.
Click to reveal answer
beginner
Why are transactions useful in databases?
They ensure that a group of operations either all succeed or all fail together, keeping data accurate and consistent.
Click to reveal answer
intermediate
What happens if you forget to use COMMIT after BEGIN?
The changes made during the transaction won't be saved permanently and may be lost if the session ends or a rollback occurs.
Click to reveal answer
Which statement starts a transaction in MySQL?
✗ Incorrect
BEGIN starts a new transaction.
What does COMMIT do in a transaction?
✗ Incorrect
COMMIT saves all changes made during the transaction permanently.
If an error occurs during a transaction, which statement should you use to undo changes?
✗ Incorrect
ROLLBACK undoes all changes made in the current transaction.
What happens if you execute multiple SQL statements without BEGIN in MySQL?
✗ Incorrect
Without BEGIN, each statement commits immediately by default.
Which of these is NOT a benefit of using transactions?
✗ Incorrect
Transactions do not create automatic backups; they manage changes atomically.
Describe the roles of BEGIN, COMMIT, and ROLLBACK in managing database transactions.
Think of a transaction like a group of tasks that must all succeed or fail together.
You got /3 concepts.
Explain why transactions are important for data integrity in databases.
Imagine paying for groceries: you want all items or none, not just some.
You got /3 concepts.