# ROLLBACK

Rolls back the open transaction if one exists.

## Syntax

```sql
ROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] [ [ NO ] RELEASE ]

```

## Remarks

* `[ AND [ NO ] CHAIN ]` and `[ [ NO ] RELEASE ]` are ignored as these options are not currently supported by SingleStore.
* This command must be run on the master aggregator or a child aggregator node (see [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md).
* [COMMIT](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/commit.md)

## Example

For this example, consider the following `Employee` table:

| ID | Name |
| -- | ---- |
| 30 | Jim  |
| 20 | Rob  |
| 40 | Rick |

```sql
BEGIN;

```

```sql
UPDATE Employee SET Name = "John" WHERE ID = 300;

```

```output

Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

```

Run the `SELECT` query to verify if the `UPDATE` is correct:

```sql
SELECT * FROM Employee;

```

```output

+------+-------+
| ID   | Name  |
+------+-------+
|   30 | Jim   |
|   20 | Rob   |
|   40 | Rick  |
+------+-------+

```

Run `ROLLBACK` since there were no matching results for the `ID` and the `UPDATE` was not successful.

```sql
ROLLBACK;

```

**Note**: Before the user runs `COMMIT` or `ROLLBACK`, only that user can see the updates made after the [BEGIN](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/begin.md) statement was run.

***

Modified at: June 22, 2022

Source: [/db/v9.1/reference/sql-reference/data-manipulation-language-dml/rollback/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/rollback/)

(An index of the documentation is available at /llms.txt)
