Reputation: 2442
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
Upvotes: 2
Views: 292
Reputation: 10140
B1 and B2 do not exist in table 1, which causes the foreign key violation.
Upvotes: 1