CS FundamentalsModerateGATE CS · PSU (ISRO/BARC)
Which statement about a FOREIGN KEY constraint in standard SQL is correct?
- A. It must reference the primary key only
- B. It may reference any UNIQUE (candidate key) column set, and its own columns may be NULL
- C. Its columns must also be the primary key of the referencing table
- D. Its columns can never be NULL
Correct answer: B. It may reference any UNIQUE (candidate key) column set, and its own columns may be NULL
A foreign key must point at a key of the referenced table (primary or UNIQUE). A NULL foreign key value is allowed and simply means 'no reference'.
More DBMS and SQL questions
- Table Score(name, pts) rows: ('a', 90), ('b', 85), ('c', 90), ('d', 70), ('e', 85), ('f', 60). What does this query return? sql SELECT…
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…
- R(A, B, C, D, E) with functional dependencies BE → A, C → AD, D → C is decomposed into R1(C, E), R2(A, D, E), R3(A, B, E). Which statement…
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…
- A B+ tree index uses 8192-byte blocks, 24-byte search keys, 10-byte block pointers and 16-byte record (data) pointers. Each leaf also…
- R has 1600 tuples in 80 blocks and S has 20000 tuples in 500 blocks. With only enough memory for one block of each relation, how many…