Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a transaction in MySQL.
MySQL
START [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using COMMIT or ROLLBACK to start a transaction.
Using SAVEPOINT to start a transaction.
✗ Incorrect
In MySQL, to begin a transaction, you use START TRANSACTION.
2fill in blank
mediumComplete the code to save changes permanently in a transaction.
MySQL
[1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROLLBACK instead of COMMIT.
Trying to use START TRANSACTION to save changes.
✗ Incorrect
Use COMMIT to save all changes made in the current transaction permanently.
3fill in blank
hardFix the error in the code to undo changes in a transaction.
MySQL
[1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using COMMIT to undo changes.
Using SAVEPOINT instead of ROLLBACK.
✗ Incorrect
To undo changes made in a transaction, use ROLLBACK.
4fill in blank
hardFill both blanks to create a savepoint and then rollback to it.
MySQL
SAVEPOINT [1]; ROLLBACK TO [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for savepoint and rollback.
Using reserved words as savepoint names.
✗ Incorrect
You name the savepoint and rollback to the same name to undo changes after that point.
5fill in blank
hardFill the two blanks to demonstrate atomicity by starting a transaction, inserting a row, and committing.
MySQL
START [1]; INSERT INTO users (name) VALUES ('Alice'); [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROLLBACK instead of COMMIT.
Not starting the transaction before insert.
✗ Incorrect
Start the transaction and commit to make the INSERT permanent. This demonstrates atomicity: either all changes succeed or none do.