COMMIT Statement
The COMMIT
statement is used to save all changes made by the current transaction to the database permanently. Once committed, the changes cannot be undone.
Example: Using COMMIT
UPDATE FreedomFighters
SET Contribution = 'Educational Reforms'
WHERE Name = 'Rohini';
COMMIT;
Output:
Changes to the FreedomFighters
table are saved permanently.
Do's and Don'ts
Do's
- Use
COMMIT
to finalize transactions only after verifying the correctness of data changes. - Ensure all necessary operations are completed successfully before committing.
Don'ts
- Don't commit incomplete or incorrect transactions.
- Don't forget to use
COMMIT
when required, especially in multi-step operations.