in Databases retagged ago by
4,518 views
11 votes
11 votes

Consider the following statements $S1$ and $S2$ about the relational data model:

  • $S1$: A relation scheme can have at most one foreign key.
  • $S2$: A foreign key in a relation scheme $R$ cannot be used to refer to tuples of $R.$

Which one of the following choices is correct?

  1. Both $S1$ and $S2$ are true
  2. $S1$ is true and $S2$ is false
  3. $S1$ is false and $S2$ is true
  4. Both $S1$ and $S2$ are false
in Databases retagged ago by
by
4.5k views

1 comment

What if the foreign key is NULL? Can we still be able to refer the tuples?
1
1

6 Answers

15 votes
15 votes
Best answer
Both $S1$ and $S2$ are FALSE.

In a relation scheme multiple foreign attributes can be present referring to primary keys of other relation schemes. A typical example is an $\text{EXAM_RESULTS(sid,eid,marks)}$ scheme where $\text{sid}$ and $\text{eid}$ are foreign keys referring to the primary keys in $\text{STUDENT}$ and $\text{EXAM}$ schemes respectively.

$S2$ is FALSE because a foreign key can refer to the same scheme (self-referencing foreign key). A typical example is an $\text{EMPLOYEE(eid, mid, $\ldots$)}$ scheme where $\text{mid}$ is the Manager ID referring to the primary key $\text{eid}$ of the same scheme.
selected by

4 Comments

Can you give an example/link of self referencing foreign keys, where it is used to refer to tuples?
0
0
1
1

Thanks @Pranavpurkar. It cleared my doubt. :)

0
0
7 votes
7 votes
Option $(D)$. Both are false. We can refer to the same table and there can be more than one foreign key.

1 comment

How to refer to tuples of R using foreign key?
1
1
2 votes
2 votes

s1 is False since a Relation may have more than one FK.

s2 is False by the definition of FK. 

1 vote
1 vote
S1 is false because there is no rule that a relation schema can have atmost one foreign key in minium. It can have more than 1 foreign key as well.

S2 is false because in a relation a foreign key cant identify a tuple uniquely. so they cant be used to refer to a tuple of R

 

answer is D both are false

1 comment

S2 is false because in a relation a foreign key cant identify a tuple uniquely. so they cant be used to refer to a tuple of R

Statement $S2$ also says we CANNOT use a foreign key to refer to tuples of relation $R$.

So as per your explanation Statement $S2$ should be true.

2
2
Answer:

Related questions