Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3724

Foreign Key problems (no replies)

$
0
0
Hello, I am new at using MySQL. I am using Innodb, and Workbench, and I am having foreign key problems. I am using Workbench, trying to make a simple genealogy database, with and PEOPLE table for people, PARENTS table for parent pairs, and SOURCES table for sources. I use this command:

INSERT INTO `mydb`.`PARENTS` (`PARE`, `SOUR`, `PARE1`, `PARE2`) VALUES ('McDowell-Mitchell', 'Source 1', 'Matthew McDowell', 'Mariah Mitchell');

and get this error:

ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`mydb`.`parents`, CONSTRAINT `PARE1` FOREIGN KEY (`PARE1`) REFERENCES `PEOPLE` (`INDI`) ON DELETE NO ACTION ON UPDATE NO ACTION)

I'm using the first and second columns on the PEOPLE table (INDI and SOUR) as a unique index, same for PARENTS (PARE and SOUR) and the foreign keys reference those columns, in the proper order (as shown by Workbench)

Maybe this is not enough information, but I will provide more if needed. Thanks for any help.

Paul Reiser

Viewing all articles
Browse latest Browse all 3724

Trending Articles