COMMIT
The COMMIT
statement saves all changes made by the current transaction permanently to the database. Once committed, the changes cannot be undone.
Example: Using COMMIT
BEGIN TRANSACTION;
DELETE FROM FreedomFighters WHERE Name = 'Vijay';
COMMIT;
Output:
Changes are saved, and the record for Vijay
is permanently deleted.
Do's and Don'ts
Do's
- Always review changes before committing, especially in production environments.
- Use
COMMIT
to finalize transactions only when data integrity is confirmed.
Don'ts
- Don't forget to commit transactions; uncommitted transactions may lock resources.
- Don't commit incorrect or incomplete data.