Keys

Question 1
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 schema R cannot be used to refer to tuples of R.
Which one of the following choices is correct?  
A
S1 is false and S2 is true.
B
Both S1 and S2 are false.
C
Both S1 and S2 are true.
D
S1 is true and S2 is false.
Question 1 Explanation: 
  • A database table may have more than one foreign key, and each foreign key can have a different parent table. Hence, the statement I is incorrect.
  • A foreign key is a set of attributes in a table that refers to the primary key of another table or to the primary key of the same table (self-referential table). Hence, the statement II is also incorrect.
Question 2
Let x, y, z, a, b, c be the attributes of an entity set E. If {x}, {x,y}, {a,b}, {a,b,c}, {x,y,z} are superkeys then which of the following are the candidate keys?
A
{x,y} and {a,b}
B
{x} and {a,b}
C
{x,y,z} and {a,b,c}
D
{z} and {c}
Question 2 Explanation: 
● A candidate key is simply the "shortest" super key. Candidate Key are individual columns in a table that qualifies for uniqueness of each row/tuple.Every table must have at least one candidate key but at the same time can have several.
Question 3
Maximum number of superkeys for the relation schema R(X,Y,Z,W) with X as the key is:
A
6
B
8
C
9
D
12
Question 3 Explanation: 
→ Maximum no. of possible super keys for a relation with n attributes with one candidate key
(only one attribute) = 2n-1
Here, n = 4.
→ So, the possible super keys = 24-1 = 8
→ The super keys are: X, XY, XZ, YZ, XYZ, XYW, YZW, XYZW.
Question 4
The primary key of any table is selected from the:
A
Composite keys
B
Foreign keys
C
Candidate keys
D
Alternate keys
Question 4 Explanation: 
→ In the relational model of databases, a primary key is a specific choice of a minimal set of attributes (columns) that uniquely specify a tuple (row) in a relation (table).
→ Informally, a primary key is "which attributes identify a record", and in simple cases are simply a single attribute: a unique id.
→ More formally, a primary key is a choice of candidate key (a minimal superkey); any other candidate key is an alternate key.
There are 4 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access