Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if auto-commit is enabled.
SQL
SHOW VARIABLES LIKE '[1]';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'auto_commit' instead of 'autocommit'.
Trying to check 'commit_mode' which is not a variable.
✗ Incorrect
The variable autocommit shows if auto-commit is enabled in the database.
2fill in blank
mediumComplete the SQL command to disable auto-commit for the current session.
SQL
SET SESSION [1] = 0;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'auto_commit' instead of 'autocommit'.
Trying to set 'commit_mode' which is invalid.
✗ Incorrect
To disable auto-commit, set autocommit to 0 for the session.
3fill in blank
hardFix the error in the SQL command to commit a transaction.
SQL
[1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'COMMIT TRANSACTION' which is not standard SQL.
Confusing commit with rollback or savepoint.
✗ Incorrect
The correct command to commit a transaction is simply COMMIT.
4fill in blank
hardFill both blanks to start a transaction and then disable auto-commit.
SQL
START [1]; SET [2] = 0;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'auto_commit' instead of 'autocommit'.
Using 'SESSION' instead of 'autocommit' for the second blank.
✗ Incorrect
Use START TRANSACTION to begin a transaction and set autocommit to 0 to disable auto-commit.
5fill in blank
hardFill all three blanks to create a transaction, insert a row, and commit the changes.
SQL
BEGIN [1]; INSERT INTO users (name) VALUES ('Alice'); [2]; [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROLLBACK instead of COMMIT to save changes.
Using START instead of BEGIN for the first blank.
✗ Incorrect
Use BEGIN TRANSACTION or START TRANSACTION to begin, then COMMIT to save changes.