I have 3 tables
Table 1: PlantName (primary key)
Table 2: (primary key(Id + PlantName)), foreign key(PlantName) references Table1(PlantName)
Table 3: (primary key(Id + PlantName)), foreign key(id) references Table2(id)
When I insert data into these tables
Table1: Ark1
Ark2
Ark3
Table 2:
1,Ark1
2,Ark1
3, Ark1
1, Ark2
2, Ark2
1, B1
2, B2
Table 3:
1,Ark1
2,Ark2
At this insertion in Table3 it has a problem with Foreign key.
Please suggest
Thank you
Sun
asked May 3, 2012 at 17:24
user575219
2,43616 gold badges59 silver badges116 bronze badges
1 Answer 1
B1 and B2 do not exist in table 1, which causes the foreign key violation.
answered May 3, 2012 at 17:28
Kevin Crowell
10.2k4 gold badges37 silver badges51 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
user575219
sorry, please see the edit. Fkey violation is caused during insertion for Table 3.
lang-sql