COMMIT
On this page
Commits the open transaction if one exists.
Syntax
COMMIT [ WORK ] [ AND [ NO ] CHAIN ] [ [ NO ] RELEASE ]
Remarks
-
[ AND [ NO ] CHAIN ]
and[ [ NO ] RELEASE ]
are ignored as these options are not currently supported by SingleStore Helios. -
If the transaction is unsuccessful or needs to be reverted, then execute the ROLLBACK command.
Example
For this example, consider the following Employee
table:
ID |
Name |
---|---|
30 |
Jimmy |
20 |
Rob |
40 |
Rick |
BEGIN;UPDATE Employee SET Name = "Jim" WHERE ID = 30;
Run the SELECT
query to verify if the UPDATE
is correct:
SELECT * FROM Employee;
+------+-------+
| ID | Name |
+------+-------+
| 30 | Jim |
| 20 | Rob |
| 40 | Rick |
+------+-------+
Run COMMIT
since the UPDATE
was successful.
COMMIT;
Note: Before the user runs COMMIT
or ROLLBACK
, only that user can see the updates made after the BEGIN statement was run.
Last modified: June 22, 2022