trunks表: create table trunks ( id smallint unsigned not null auto_increment, owner smallint unsigned not null references participants (id), name varchar(25) not null, price decimal(5 , 2 ) not null, description mediumtext not null, primary key (id) ) engine=innodb;participants表: create table trunks ( id smallint unsigned not null auto_increment, name varchar(35) not null, email varchar(45) not null, cash decimal(5,2) not null, primary key (id) ) engine=innodb;事务过程: start transaction;update participants set cash=cash-12.99 where id=1; update participants set cash=cash+12.99 where id=2; update trunks set owner=1 where name='Abacus' and id=1;rollback;select * from participants; select * from trunks;
create table trunks (
id smallint unsigned not null auto_increment,
owner smallint unsigned not null references participants (id),
name varchar(25) not null,
price decimal(5 , 2 ) not null,
description mediumtext not null,
primary key (id)
) engine=innodb;participants表:
create table trunks (
id smallint unsigned not null auto_increment,
name varchar(35) not null,
email varchar(45) not null,
cash decimal(5,2) not null,
primary key (id)
) engine=innodb;事务过程:
start transaction;update participants set cash=cash-12.99 where id=1;
update participants set cash=cash+12.99 where id=2;
update trunks set owner=1 where name='Abacus' and id=1;rollback;select * from participants;
select * from trunks;