Junior — Middle
What reserved word in SQL indicates the start or end of a transaction?
sobes.tech AI
Answer from AI
In SQL, reserved words BEGIN, COMMIT, and ROLLBACK are used to manage transactions.
BEGIN(orBEGIN TRANSACTION) indicates the start of a transaction.COMMITrecords all changes made within the transaction.ROLLBACKcancels all changes made since the transaction started.
Example:
BEGIN TRANSACTION;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;
Thus, BEGIN and COMMIT are keywords for starting and ending a transactional operation.