in Databases edited by
2,682 views
1 vote
1 vote

Which of the following key constraints is required for functioning of foreign key in the context relational databases?

  1. Unique key
  2. Primary key
  3. Candidate key
  4. Check key
in Databases edited by
by
2.7k views

1 comment

PRIMARY KEY
0
0

2 Answers

0 votes
0 votes

Answer can be 3 candidate key according to Wikipedia

A foreign key is a set of attributes that references a candidate key.

 

Foreign key 
If an attribute can only take the values which are present as values of some other attribute, it will be foreign key to the attribute to which it refers. The relation which is being referenced is called referenced relation and corresponding attribute is called referenced attribute and the relation which refers to referenced relation is called referencing relation and corresponding attribute is called referencing attribute.

https://en.m.wikipedia.org/wiki/Foreign_key

But according to reference books Korth, Raghu ramkrishan

Answer must be B primary key because candidate key can be NULL such case reference can be break but primary key always unique and not null. It should be appropriate and right option.

edited by

4 Comments

If candidate key is null in such case foreign key points to primary key

So shouldn't primary key be more appropriate option ? coz foreign keys can always point to primary key but not to candidate key.

0
0
Yes , it should be primary key.
0
0

In korth book also given

A foreign key key points to primary key.

Raghu ramkrishan book also 

But why Wikipedia focusing on candidate key at beginning in definition even though itself describing about foreign key using primary key also.

https://en.m.wikipedia.org/wiki/Foreign_key

0
0
0 votes
0 votes

 The referential integrity property states that

When a foreign key value is used it must reference a valid, existing primary key in the parent table.

$\therefore$ Option $B.$ is correct.

edited by
Answer:

Related questions