🗄️ Database Design / Normalization
Beginner
What is a NULL value in databases?
Answer
NULL represents the absence of a value — an unknown or inapplicable value. It is not zero, not an empty string, and not "false." NULL comparisons always return NULL (unknown), not true/false: NULL = NULL is NULL, not TRUE. Use IS NULL and IS NOT NULL for comparisons. NULL propagates through expressions: 100 + NULL = NULL. Aggregate functions ignore NULLs (except COUNT(*)). Best practices: use COALESCE(column, default) to substitute a default for NULL; add NOT NULL constraints to required columns; be careful with NULLs in JOINs and WHERE clauses as they can silently exclude rows.
Previous
What is the difference between WHERE and HAVING?
Next
What is a surrogate key vs natural key?