SQL Server Interview Question #162
What is First Normal Form (1NF)?
Database Design, Normalization & Advanced SQL Senior Advanced
Detailed Explanation
A table is generally considered to satisfy First Normal Form when each row/column intersection contains a single value from the column's domain and repeating groups are removed.
For example, storing multiple phone numbers in one comma-separated PhoneNumbers column makes relational querying, validation, indexing, and referential integrity difficult. A separate CustomerPhones table is usually a better relational design.
Code Example
CREATE TABLE dbo.CustomerPhones
(
CustomerId INT NOT NULL,
PhoneNumber NVARCHAR(30) NOT NULL,
PhoneType NVARCHAR(20) NULL,
CONSTRAINT PK_CustomerPhones
PRIMARY KEY (CustomerId, PhoneNumber)
);