Primary keys: Natural versus Surrogate Keys

From Robs_Wiki
Revision as of 15:37, 16 January 2020 by Qadmin wiki (talk | contribs) (Created page with "__TOC__ == Introduction == When you design tables with SQL Server, a table typically has a column or a number of columns that are known as the primary key. The primary key is...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

When you design tables with SQL Server, a table typically has a column or a number of columns that are known as the primary key. The primary key is a unique value that identifies each record. Sometimes the primary key is made up of real data and these are normally referred to as natural keys, while other times the key is generated when a new record is inserted into a table. When a primary key is generated at runtime, it is called a surrogate key. A surrogate key is typically a numeric value. Within SQL Server, Microsoft allows you to define a column with an identity property to help generate surrogate key values.