Complete the code to save changes permanently in the database.
INSERT INTO employees (name, position) VALUES ('Alice', 'Manager'); [1];
The COMMIT command saves all changes made in the current transaction permanently to the database.
Complete the code to undo changes made in the current transaction.
UPDATE accounts SET balance = balance - 100 WHERE id = 5; [1];
The ROLLBACK command undoes all changes made in the current transaction, reverting the database to its previous state.
Fix the error in the transaction control by choosing the correct command.
BEGIN TRANSACTION; DELETE FROM orders WHERE order_id = 10; [1];
After making changes in a transaction, use COMMIT to save them permanently. 'START' is not a valid command here.
Fill both blanks to create a savepoint and then rollback to it.
BEGIN TRANSACTION; INSERT INTO products VALUES (101, 'Pen'); [1] save1; UPDATE products SET price = 1.5 WHERE id = 101; [2] save1;
SAVEPOINT creates a point to which you can rollback. ROLLBACK save1 undoes changes after that savepoint.
Fill all three blanks to start a transaction, create a savepoint, and commit changes.
[1]; INSERT INTO customers VALUES (201, 'John'); [2] savepoint1; UPDATE customers SET city = 'NY' WHERE id = 201; [3];
Start with BEGIN TRANSACTION, create a SAVEPOINT, and finally COMMIT to save all changes.