COMMIT
In one line
COMMIT is the SQL command that permanently saves all changes made during the current transaction.
In simple words
COMMIT ends a transaction by saving all its changes permanently to the database. Once you commit, the changes are visible to other transactions and cannot be undone (except by a new transaction that reverses them).
A typical transaction flow is: BEGIN → run SQL statements → COMMIT (if everything went well) or ROLLBACK (if something went wrong).
After COMMIT, the transaction is closed and a new one begins (in some modes, automatically). The committed changes satisfy the Durability property of ACID — they survive crashes.
Example
BEGIN;
INSERT INTO orders (user_id, total) VALUES (1, 99.99);
UPDATE users SET last_order_at = NOW() WHERE id = 1;
COMMIT; -- Both changes are now permanentAfter COMMIT, the new order and the updated timestamp are both saved permanently.
Related terms
Related Resources
Related Lessons
- Transactions
Learn COMMIT and ROLLBACK.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.