Mysql:
есть две таблицы InnoDB
table1(id_name, name)
и
table2(id_number auto_increment,
id_name,
number,
CONSTRAINT `table2_fk` FOREIGN KEY (`id_name`) REFERENCES `table1` (`id_name`) ON DELETE CASCADE ON UPDATE CASCADE)
----------
При попытке добавить запись в table2:
Insert into `table2` (id_number, id_name, `number`)
Values (NULL, '2', '9009')
ошибка: "Cannot add or update a child row: a foreign key constraint fails (`ikr`.`table2`, CONSTRAINT `table2_fk` FOREIGN KEY (`id_name`) REFERENCES `table1` (`id_name`) ON DELETE CASCADE)
|