If I am manually inserting hundreds of rows, how should I efficiently write the insert statements so that each insert will not run only if both foreign keys are already present together in a record in that database?
How to prevent inserting duplicate rows based on two foreign keys?
1.7k views Asked by Orin At
2
Create a
constrainton the columns, here is a great reference starting point.Here is an example of a
FOREIGN KEYconstraint, and for defining aFOREIGN KEYconstraint on multiple columns, use the following SQL syntax: