문제

I am trying to create foreign key for my database. My database is for a gym system.

I have the table called user. Within that table I have user_id which is my primary key. I have another table call member within this table I also have user_id which I want to make a foreign key so it relates to my user_id within the user table.

But i keep getting the following error..

#1452 - Cannot add or update a child row: a foreign key constraint fails (Gym_System.#sql-247a_3c1, CONSTRAINT #sql-247a_3c1_ibfk_1 FOREIGN KEY (user_id) REFERENCES members (user_id))

Can anyone help?

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top