1 2 3 4 5 6 7 8 9 10 11 12 |
CREATE TABLE t1 (id INT PRIMARY KEY); CREATE TABLE `t2` LIKE `t1`; ALTER TABLE `t2` ADD FOREIGN KEY (`id`) REFERENCES `t1`(`id`); CREATE TABLE `t3` LIKE `t2`; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `id` INT NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ) ENGINE=InnoDB COLLATE = utf8_general_ci DROP TABLE t2, t3, t1; |