MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
An attribute in a relation is a foreign key if the ____ key from one relation Is used as an attribute in that relation.
A
Candidate
B
Primary
C
Alternate
D
None of the above
Explanation: 

Detailed explanation-1: -A foreign key is an attribute whose value is derived from the primary key of another relation. This means that any attribute of a relation (referencing), which is used to refer contents from another (referenced) relation, becomes foreign key if it refers to the primary key of referenced relation.

Detailed explanation-2: -Explanation: A relation, say r1, may include among its attributes the primary key of another relation, say r2. This attribute is called a foreign key from r1, referencing r2.

Detailed explanation-3: -Yes. You would do this for instance if you wanted to enforce that all employees are users, and some users can be employees. This would be (zero or one) to one relationship.

Detailed explanation-4: -Which one of the following attribute can be taken as a primary key? Explanation: The attributes name, street and department can repeat for some tuples. But the id attribute has to be unique. So it forms a primary key.

Detailed explanation-5: -Primary and foreign keys are the most basic components on which relational database theory is based. Primary keys enforce entity integrity by uniquely identifying entity instances. Foreign keys enforce referential integrity by completing an association between two entities.

There is 1 question to complete.