1
DROP TABLE IF EXISTS t1, t2;
3
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
4
, padding VARCHAR(200) NOT NULL
6
INSERT INTO t1 VALUES (1, "I love testing.");
7
INSERT INTO t1 VALUES (2, "I hate testing.");
8
REPLACE INTO t1 VALUE (2, "I love testing.");
11
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
12
, padding VARCHAR(200) NOT NULL
15
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
17
, CONSTRAINT fk_t1 FOREIGN KEY (fk_id) REFERENCES t1 (id) ON DELETE CASCADE
19
INSERT INTO t1 VALUES (1, "I love testing.");
20
INSERT INTO t1 VALUES (2, "I hate testing.");
21
REPLACE INTO t1 VALUE (2, "I love testing.");
23
DROP TABLE IF EXISTS `t1`;
24
DROP TABLE IF EXISTS `t2`;
25
CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL ) ENGINE=InnoDB;
26
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
27
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
28
UPDATE `test`.`t1` SET `padding`='I love testing.' WHERE `id`=2;
30
CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL ) ENGINE=InnoDB;
31
CREATE TABLE t2 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , fk_id INT NOT NULL , CONSTRAINT fk_t1 FOREIGN KEY (fk_id) REFERENCES t1 (id) ON DELETE CASCADE ) ENGINE=InnoDB;
32
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
33
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
34
DELETE FROM `test`.`t1` WHERE `id`=2;
35
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I love testing.');
38
SET GLOBAL transaction_log_truncate_debug= true;