0 day streak
sql / beginner
Snippet

Reverting Uncommitted Changes with ROLLBACK

The ROLLBACK statement cancels all database modifications made during the current uncommitted transaction, restoring data to its previous state.

snippet.sql
sql
1
2
3
4
UPDATE product_inventory
SET stock_quantity = 0;
ROLLBACK;
Breakdown
1
UPDATE product_inventory
Specifies the target table whose rows will be updated.
2
SET stock_quantity = 0;
Modifies the stock_quantity column value to 0 across all records.
3
ROLLBACK;
Cancels the update operation and restores original table values before commit.