COMMIT

The COMMIT statement is used to apply all transaction changes.

All statements within a transaction will not be visible to other transactions until all changes are applied with COMMIT or all changes are discarded with ROLLBACK.

Nested transactions are not supported and COMMIT or ROLLBACK cannot be used when not in a transaction, otherwise an error is returned.

Syntax

COMMIT [ WORK ]

Examples

-- From connection 1:
START TRANSACTION;

INSERT INTO products (name, price)
VALUES ('Coffee Machine', 150);

-- From connection 2:
SELECT * FROM products;
-- empty

-- From connection 1:
COMMIT;

-- From connection 2:
SELECT * FROM products;
-- NAME: Coffee Machine PRICE: 150

See Also