COMMIT
一句话解释
COMMIT 是 SQL command 那个 permanently 保存所有更改制作期间 current 事务.
用大白话说
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.
示例
sql
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 permanent之后 COMMIT, 新顺序 and 更新 timestamp 是两者都保存 permanently.
相关术语
相关资源
相关课程
- 事务
学习 COMMIT and ROLLBACK.
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。