Is it possible to link/reference one foreign key to two values in another table? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to link/reference one foreign key to two values in another table?

Customer: Mobilenumber(PK) Firstname, Lastname Dog: DogID(PK), Owner(FK) Is it possible to link Owner(FK) in table Dog to both Firstname and Lastname in table Customer?

21st Apr 2020, 6:14 AM
W. Khalid
2 Answers
+ 2
I guess it makes more sense to reference the PK of the Customer table, it is more likely to be unique rather than first or last name. I never heard a foreign key references multiple columns, but maybe I am wrong.
21st Apr 2020, 6:58 AM
Ipang
+ 1
You can define an class object, which has several attributes and take an link to that(if there are classes ins sql)
21st Apr 2020, 7:32 AM
Alexander Thiem
Alexander Thiem - avatar