SQL/MySQL/Transaction/RollBack — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 10:16, 26 мая 2010
User transaction in table
/*
mysql> select * from Student;
+-----------+------------+
| StudentID | Name |
+-----------+------------+
| 1 | JJ Smith |
| 2 | Joe Wang |
| 3 | John Lee |
| 4 | Jacky Chen |
+-----------+------------+
4 rows in set (0.03 sec)
*/
Drop table Student;
CREATE TABLE Student (
StudentID INT NOT NULL PRIMARY KEY,
Name VARCHAR(50) NOT NULL
)TYPE = InnoDB;
INSERT INTO Student (StudentID,Name) VALUES (1,"JJ Smith");
INSERT INTO Student (StudentID,Name) VALUES (2,"Joe Wang");
INSERT INTO Student (StudentID,Name) VALUES (3,"John Lee");
INSERT INTO Student (StudentID,Name) VALUES (4,"Jacky Chen");
BEGIN;
INSERT INTO Student (StudentID, Name) VALUES (98, "Anne");
INSERT INTO Student (StudentID, Name) VALUES (99, "Julian");
ROLLBACK;
select * from Student;