By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Table | Create Table |
---|---|
test | CREATE TABLE `test` ( `id` int NOT NULL, `val1` int DEFAULT NULL, `val2` int DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `val1` (`val1`), KEY `val2` (`val2`), CONSTRAINT `test_ibfk_1` FOREIGN KEY (`val2`) REFERENCES `test` (`val1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
Records: 0 Duplicates: 0 Warnings: 0
Table | Create Table |
---|---|
test | CREATE TABLE `test` ( `id` int NOT NULL, `val1` int DEFAULT NULL, `val2` int DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `val1` (`val1`), KEY `val2` (`val2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |