Complete the code to start a transaction in SQL.
BEGIN [1];To start a transaction, you use BEGIN TRANSACTION. This tells the database to start a group of operations that will be treated as one.
Complete the code to save changes permanently in a transaction.
[1] TRANSACTION;COMMIT TRANSACTION saves all changes made during the transaction permanently to the database.
Fix the error in the code to undo changes in a transaction.
ROLLBACK [1];ROLLBACK TRANSACTION undoes all changes made in the current transaction.
Fill both blanks to create a savepoint and rollback to it.
SAVEPOINT [1]; ROLLBACK TO [2];
A savepoint is a named point within a transaction. You can rollback to it using the same name. Here, both blanks use the same savepoint name sp1.
Fill all three blanks to complete a transaction that inserts data and commits it.
BEGIN [1]; INSERT INTO users (name, age) VALUES ('Alice', 30); [2] [3];
The transaction starts with BEGIN TRANSACTION, then after the insert, it ends with COMMIT TRANSACTION to save changes.