Data Modeling easy
In SQL, what does a value of `NULL` conceptually represent?
- A The mathematical number Zero (0), which is used to represent a valid numerical quantity within the database's integer columns.
- B A literal 'Empty String' (""), which represents a valid text sequence that contains no characters but consumes memory.
- C The concept of 'Unknown' or 'Missing' data, indicating and explicitly distinguishing that a specific value has not been recorded.
- D A specialized system error code that is triggered when a file-system operation fails to retrieve a specific record from the disk.
Answer: C. The concept of 'Unknown' or 'Missing' data, indicating and explicitly distinguishing that a specific value has not been recorded.
In SQL, `NULL` is not a value, but a state representing the absence of a value. This is a critical distinction in database logic: `NULL` is not equal to zero or an empty string. Most relational databases use Three-Valued Logic (True, False, Unknown), where any comparison with a `NULL` (like `NULL = NULL`) results in `Unknown` rather than `True`.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When modeling a Distributed Transaction using the Saga Pattern (Choreography or Orchestration), what type of consistency do you achieve?
- Which practice prevents SQL Injection attacks?
- What is 'Bi-Temporal' data modeling (e.g., in SQL:2011 standard)?
- Adding an Index to a database column generally improves Read performance. What is the negative trade-off?
- Log Systems Merge (LSM) Trees (used in RocksDB, Cassandra) optimize for fast writes. What is their primary downside regarding Disk I/O?
- What is the primary objective of normalizing a relational database schema (e.g., to 3NF)?