0
0
SQLquery~10 mins

Why transactions are needed in SQL - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a transaction in SQL.

SQL
BEGIN [1];
Drag options to blanks, or click blank then click option'
ASAVEPOINT
BCOMMIT
CROLLBACK
DTRANSACTION
Attempts:
3 left
💡 Hint
Common Mistakes
Using COMMIT to start a transaction instead of ending it.
Using ROLLBACK to start a transaction.
Forgetting to start a transaction before multiple related operations.
2fill in blank
medium

Complete the code to save changes permanently in a transaction.

SQL
[1] TRANSACTION;
Drag options to blanks, or click blank then click option'
ACOMMIT
BROLLBACK
CBEGIN
DSAVEPOINT
Attempts:
3 left
💡 Hint
Common Mistakes
Using BEGIN instead of COMMIT to save changes.
Using ROLLBACK which cancels changes.
Not committing after making changes.
3fill in blank
hard

Fix the error in the code to undo changes in a transaction.

SQL
ROLLBACK [1];
Drag options to blanks, or click blank then click option'
ASAVEPOINT
BCOMMIT
CTRANSACTION
DBEGIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROLLBACK without TRANSACTION keyword.
Using COMMIT instead of ROLLBACK to undo changes.
Using SAVEPOINT incorrectly here.
4fill in blank
hard

Fill both blanks to create a savepoint and rollback to it.

SQL
SAVEPOINT [1];
ROLLBACK TO [2];
Drag options to blanks, or click blank then click option'
Asp1
Btransaction1
Csp_save
Drollback_point
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for savepoint and rollback.
Using transaction names instead of savepoint names.
Forgetting to create a savepoint before rollback to it.
5fill in blank
hard

Fill all three blanks to complete a transaction that inserts data and commits it.

SQL
BEGIN [1];
INSERT INTO users (name, age) VALUES ('Alice', 30);
[2] [3];
Drag options to blanks, or click blank then click option'
ATRANSACTION
BCOMMIT
DROLLBACK
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROLLBACK instead of COMMIT to save changes.
Not using TRANSACTION keyword after BEGIN or COMMIT.
Mixing up the order of commands.