-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy path26.commit_rollback
More file actions
35 lines (22 loc) · 950 Bytes
/
Copy path26.commit_rollback
File metadata and controls
35 lines (22 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
My complete SQL Masterclass Notes in Tanglish is now live! Covers 30+ topics with syntax, examples, and step-by-step explanations.
Perfect for both beginners and professionals to master SQL easily. Check it out here 👉 https://topmate.io/dataengineering/1697791
====================================================================================
CREATE TABLE Accounts (
AccountID INT PRIMARY KEY,
AccountHolder VARCHAR(100),
Balance DECIMAL(10,2)
);
-- Insert a new record into Accounts
INSERT INTO Accounts (AccountID, AccountHolder, Balance)
VALUES (1, 'Alice', 5000.00);
START TRANSACTION;
-- Perform one or more SQL statements
UPDATE Accounts SET Balance = Balance - 1000 WHERE AccountID = 1;
select * from accounts;
-- If all statements execute successfully, commit the transaction
COMMIT;
-- or
UPDATE Accounts SET Balance = Balance - 1000 WHERE AccountID = 1;
select * from accounts;
rollback;
select * from accounts;