Transactions

SQL COMMIT

Make the current transaction's changes permanent.

Availability: Common SQL with references for SQL standard, MySQL/MariaDB, PostgreSQL, SQL Server, SQLite and Oracle Database; syntax and feature support vary by engine and version.中文

Syntax

COMMIT [TRANSACTION];

Examples

Example (standard-style syntax). Verify supported keywords in your database.

BEGIN; UPDATE settings SET value = 'on' WHERE key = 'feature'; COMMIT;

SQLite-oriented variant; dialect behaviour may differ.

START TRANSACTION; UPDATE settings SET value = 'on' WHERE `key` = 'feature'; COMMIT;

Parameters, options and clauses

Option / clauseDescription
BEGIN / START TRANSACTIONStart a transaction; exact keywords vary by engine.
COMMITMake the transaction's changes permanent.
ROLLBACKUndo uncommitted work or return to a savepoint.
SAVEPOINTMark an intermediate point within a transaction.
Isolation levelChoose concurrency behaviour where supported.

Dialect references

Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory