I have this:
ID1 INTEGER PRI
ID2 INTEGER PRI
NAME VARCHAR
now I need to:
ID1_REF INTEGER REFERENCE TO ID1
DESCRIPTION VARCHAR
so, one column refers to one column of primary key, not to 2 column. Is it even possible in relational databases?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No you can’t.
The foreign key must reference either the primary key or another superkey (a set of attributes/columns that uniquely identifies the row in that table, whether or not that is the actual declared primary key) in the referenced table.
It’s worth reading the Wikipedia article as well.