- Learning PostgreSQL 10(Second Edition)
- Salahaldin Juba Andrey Volkov
- 225字
- 2021-07-02 22:42:03
Entity integrity constraint
In the relational model, a relation is defined as a set of tuples. This means that all the tuples in a relation must be distinct. The entity integrity constraint is enforced by having a primary key which is an attribute/set of attributes having the following characteristics:
- The attribute should be unique
- The attributes should be not null
Each relation must have only one primary key, but can have many unique keys. A candidate key is a minimal set of attributes that can identify a tuple. All unique, not null attributes can be candidate keys. The set of all attributes form a super key. In practice, we often pick up a single attribute to be a primary key instead of a compound key ( a key that consists of two or more attributes that uniquely identify a tuple) to ease the joining of the relations with each other.
If the primary key is generated by the DBMS, then it is called a surrogate key or synthetic key . Otherwise, it is called a natural key. The surrogate key candidates can be sequences and universal unique identifiers (UUID). A surrogate key has many advantages such as performance, requirement change tolerance, agility, and compatibility with object relational mappers. The chief disadvantage of surrogate keys is that , it makes redundant tuples possible.
- 大數(shù)據(jù)管理系統(tǒng)
- Getting Started with Containerization
- Java開發(fā)技術(shù)全程指南
- 快學(xué)Flash動畫百例
- 大數(shù)據(jù)技術(shù)入門(第2版)
- 深度學(xué)習(xí)中的圖像分類與對抗技術(shù)
- WordPress Theme Development Beginner's Guide(Third Edition)
- 統(tǒng)計策略搜索強(qiáng)化學(xué)習(xí)方法及應(yīng)用
- AWS Certified SysOps Administrator:Associate Guide
- Windows 7寶典
- 網(wǎng)絡(luò)安全與防護(hù)
- 網(wǎng)絡(luò)服務(wù)器搭建與管理
- AVR單片機(jī)工程師是怎樣煉成的
- Kubernetes on AWS
- Learning iOS 8 for Enterprise