GATE | GATE-CS-2014-(Set-1) | Question 65

Given the following statements:

    S1: A foreign key declaration can always 
        be replaced by an equivalent check
        assertion in SQL.
    S2: Given the table R(a,b,c) where a and
        b together form the primary key, the 
        following is a valid table definition.
        CREATE TABLE S (
            a INTEGER,
            d INTEGER,
            e INTEGER,
            PRIMARY KEY (d),
            FOREIGN KEY (a) references R) 

Which one of the following statements is CORRECT?
(A) S1 is TRUE and S2 is FALSE.
(B) Both S1 and S2 are TRUE.
(C) S1 is FALSE and S2 is TRUE.
(D) Both S1 and S2 are FALSE.


Answer: (D)

Explanation:

    S1: A foreign key declaration can always
        be replaced by an equivalent check
        assertion in SQL. 

False:
Check assertions are not sufficient to replace foreign key. Foreign key declaration may have cascade delete which is not possible by just check insertion.

    S2: Given the table R(a,b,c) where a and
        b together form the primary key, the
        following is a valid table definition.
        CREATE TABLE S (
            a INTEGER,
            d INTEGER,
            e INTEGER,
            PRIMARY KEY (d),
            FOREIGN KEY (a) references R) 

False:
Foreign key in one table should uniquely identifies a row of other table. In above table definition, table S has a foreign key that refers to field ‘a’ of R. The field ‘a’ in table S doesn’t uniquely identify a row in table R.


Quiz of this Question



My Personal Notes arrow_drop_up

Recommended Posts:



0 Average Difficulty : 0/5.0
No votes yet.






User Actions