1. The existing slave table score foreign key player_id is associated with the main table playerinfo primary key id.
2. When adding data to the slave table, an error occurred:
Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (racesys
.score
, CONSTRAINTscore_player_id_foreign
FOREIGN KEY (player_id
) REFERENCESplayerinfo
(id
)) (SQL: insert intoscore
(id
,player_id
,node
,childnode
,time
) values (041be572-2ed5-3e01- ac2c-43bab35117e9, 00ec1635-0fd5-3481-a3d4-0afa4e8f66ea, 1, 1, 2007-05-23 14:38:26))"
3.
playerinfo primary key id attribute
]
score foreign key player_id attribute
Question: What is the reason for the foreign key constraint failure? How to solve?
When adding the slave table, the foreign key must have data in the primary key of the master table.