In a relational database model, NULL values can be used for all but which one…
2016
In a relational database model, NULL values can be used for all but which one of the following ?
- A.
To allow duplicate tuples in the table by filling the primary key column(s) with NULL.
- B.
To avoid confusion with actual legitimate data values like 0 (zero) for integer columns and ’’ (the empty string) for string columns.
- C.
To leave columns in a tuple marked as ’’unknown’’ when the actual value is unknown.
- D.
To fill a column in a tuple when that column does not really ”exist” for that particular tuple.
Attempted by 1146 students.
Show answer & explanation
Correct answer: A
Answer: To allow duplicate tuples in the table by filling the primary key column(s) with NULL.
Explanation: Primary key columns must uniquely identify each tuple and cannot contain NULL values. A primary key implies a NOT NULL constraint, so using NULL in primary key columns to permit duplicates is not allowed.
Why the chosen statement is not allowed: Allowing NULL in primary key columns would violate the requirement that primary keys be non-NULL and unique. Most relational DBMS enforce this by disallowing NULL primary keys.
Why the other statements are valid uses of NULL: NULL indicates missing, unknown, or not-applicable information and is distinct from concrete values such as 0 or the empty string.
Practical note: NULL participates in three-valued logic (true/false/unknown), so comparisons with NULL behave differently than comparisons with ordinary values; that is another reason NULL cannot be treated like a regular value for primary-key uniqueness checks.