A-Z Popular Blog Databases Search »
Technology
 Advertisements
Related Guides

What is a Unique Constraint?

 , updated on December 23, 2016
A unique constraint is a field or set of fields that must be unique for each row in a table. Data architects define unique constraints so that databases will automatically enforce the logical validity of data. Where a unique constraint is defined, the database will not permit duplicate values for the field or set of fields in the constraint definition.

Primary Key vs Unique Constraint

A primary key is a defined field or set of fields that a data architect identifies as the selected way to relate to a table. Once defined, all foreign keys that relate to the table must do so with the primary key. Only one primary key can be defined for a table.
A primary key automatically has a unique constraint applied to it. As only one primary key can be defined in a table, subsequent definitions to prevent duplicates in tables are defined with a unique constraint.

Example

A CUSTOMER table has an ID as a primary key and NAME, MOBILE_PHONE as a unique constraint. Foreign keys relate to the table using ID. It is impossible to enter someone with the same name and mobile phone number into the table as the database will throw an error.
Overview: Unique Constraint
TypeDatabases
DefinitionA field or set of fields that must be unique for each row in a table.
ValuePrevents data duplication.
Related ConceptsPrimary Key
Foreign Key
Candidate Key
Databases

IT Skills

This is the complete list of articles we have written about it skills.
Algorithms
Analytics
Architecture
Artificial Intelligence
Automation
Big Data
Coding
CRM
Data
Data Mining
Databases
Design
Devops
ERP
Gamification
Information Security
IT Examples
Legacy Software
Office Productivity
Problem Management
Process Automation
Robotics
SCM
Service Delivery
Service Management
Software Design
Testing
If you enjoyed this page, please consider bookmarking Simplicable.
 

Databases

A list of database terms.

Primary Key vs Candidate Key

The difference between primary key and candidate key including an example.

Atomicity

The definition of atomicity with common examples.

Operational Database

A definition of operational database with examples.

Database Skills

A list of common database skills.

Row vs Column

The difference between row and column explained with examples.

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 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.
The most popular articles on Simplicable in the past day.

New Articles

Recent posts or updates on Simplicable.
Site Map