A-Z Popular New Data Search »
Data
 
Technology Guides

What is a Primary Key?

 , updated on
A primary key is a column or list of columns that uniquely identify a row in a table.

Purpose

Primary keys define how to unique identify one piece of data in a table. As such, it is a good practice for all tables to define a primary key.

Technical Details

Primary keys are a type of constraint that is defined for a table. Tables can not have a duplicate or NULL primary key and the database will enforce this. Tables refer to each other using primary keys. When they do, a constraint called foreign key is defined.

Sequence Numbers

It is very common to define an "id" column for every table as a primary key. These are typically auto-incrementing sequence numbers that start 1,2,3... In many cases, it is possible to use actual data as a primary key but this tends to be more troublesome. It can also be less efficient as primary keys often get stored in all kinds of indexes and keeping them small is a good idea. For example, you could identify the citizens of a city with a combination of their name and phone number but this tends to more problematic than simply defining an auto-incrementing id. For example, phone numbers change and get reassigned to new people.

Example

Consider a Stadium database that has a Seat table with a unique entry for every seat in the stadium. A seat could be identified by a combination of its section, row and seat number. Since this is kinda complicated, the database architect might just define a primary key called "id" that is numbered 1,2,3..
Overview: Primary Key
Type
Definition (1)
A column or list of columns that uniquely identify a row in a table.
Definition (2)
A constraint defined for a table that indicates the column or columns that uniquely identify a row.
Related Concepts

Data

This is the complete list of articles we have written about data.
Abstract Data
Atomic Data
Big Data
Causality
Cohort
Cohort Analysis
Dark Data
Data
Data Analysis
Data Architecture
Data Attribute
Data Cleansing
Data Collection
Data Complexity
Data Consumer
Data Control
Data Corruption
Data Custodian
Data Degradation
Data Dredging
Data Entity
Data Federation
Data Integration
Data Integrity
Data Liberation
Data Lineage
Data Literacy
Data Loss
Data Management
Data Massage
Data Migration
Data Mining
Data Owner
Data Producer
Data Quality
Data Remanence
Data Risks
Data Rot
Data Science
Data Security
Data States
Data Transformation
Data Uncertainty
Data Veracity
Data View
Data Virtualization
Data Volume
Data Wipe
Decision Support
Deep Magic
Degaussing
Empirical Evidence
ETL
Event Data
Hard Data
Information Assurance
Legacy Data
Machine Data
Market Research
Master Data
Metadata
Metrics
Misuse of Statistics
Overfitting
Personal Data
Personal Information
Predictive Analytics
Primary Data
Primary Research
Privacy
Qualitative Data
Qualitative Info
Quantification
Quantitative Data
Raw Data
Reference Data
Small Data
Soft Data
Source Data
Statistical Analysis
Statistical Population
Structured Data
Transaction Processing
Transactional Data
Types Of Data
Unstructured Data
If you enjoyed this page, please consider bookmarking Simplicable.
 

Data

An overview of data with a list of examples.

Types Of Data

The basic types of data.

Dark Data

The definition of dark data with examples.

Data Massage

The mysteries of data massage.

Data Definition

Several useful definitions of data.

Analytics

A definition of analytics with examples.

Data vs Information

The difference between data and information.

Hard Data vs Soft Data

The difference between hard data and soft data.

Human Readable

A definition of human readable.

Data Loss

The common types of data loss.

Data Management

An overview of data management with examples.

Data Governance vs Data Management

The difference between data governance and data management.

Data Liberation

An overview of data liberation.

Master Data Management

An overview of master data management.

Single Source Of Truth

A definition of single source of truth, a data management strategy.

Data Escrow

An overview of data escrow.

Data Availability

An overview of data availability.

Data Proliferation

A definition of data proliferation with examples.

Namespace

The definition of namespace with examples.

Data Science Skills

An list of commonly cited data science skills.
The most popular articles on Simplicable in the past day.

New Articles

Recent posts or updates on Simplicable.
Site Map