Q4. What is a primary key, and what rules must it follow?
A primary key is the column or set of columns that uniquely identifies each row in a table. No two rows can share the same primary key value, and it can never be NULL, so every row is guaranteed addressable.
A table has at most one primary key, though it can span multiple columns (a composite key). Most databases automatically create a unique index on it, which is why lookups by primary key are fast. If several columns could serve as the key, those are candidate keys, and you pick one as primary.
CREATE TABLE employees (
id BIGINT PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
full_name TEXT NOT NULL
);Key point: State both rules in practice: unique and never NULL. Forgetting the NULL rule is the most common slip on this one.