SQL Server Interview Question #15
What is a primary key?
SQL Server Fundamentals Junior Beginner
Detailed Explanation
A primary key is a constraint that uniquely identifies each row in a table. Primary-key values must be unique and cannot be NULL.
A table can have only one primary-key constraint, but the primary key can contain more than one column; this is called a composite primary key.
Code Example
CREATE TABLE Customers
(
Id INT PRIMARY KEY,
Name NVARCHAR(100) NOT NULL
);