sql / beginner
Snippet
Saving Transaction Changes Permanently with COMMIT
The COMMIT statement finalizes all modifications made within the current database transaction. Once committed, changes become permanent and visible to all other database users.
snippet.sql
sql
1
2
UPDATE inventory SET stock_quantity = stock_quantity - 5 WHERE product_id = 42;COMMIT;
Breakdown
1
UPDATE inventory SET stock_quantity = stock_quantity - 5 WHERE product_id = 42;
Modifies the stock quantity for a specific product item in the inventory table.
2
COMMIT;
Saves all changes made during the current transaction permanently to the database.