0

I have question about a foreign key.

Primary key which is foreign key in an relationship is specified NOT NULL in some book's example. Why?

I was thinking that primary key couldn't take on value "null" in an relation. Hence if it is a foreign key in a relationship it couldn't take on value "null" de facto. Otherwise such modification violates key constraints since foreign key has to be one of the values contained in the table it points to in attribute which is primary key. Thank you very much.

1

1 Answer 1

1

A foreign key null means that there may not be an entry on the other side. In a master-detail relationship it means a detail can exist without a master.

1
  • Thank you. You mean that if one delete a tuple in a relation, the foreign key nonetheless will continue to hold value?
    – Tima Tru
    Apr 10, 2016 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.