- Learning PostgreSQL 11
- Salahaldin Juba Andrey Volkov
- 281字
- 2021-07-02 13:11:38
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 with 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 simplify 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 (UUIDs). 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.
- Python入門很簡單
- 騰訊iOS測試實踐
- Python程序設計(第3版)
- PyTorch Artificial Intelligence Fundamentals
- Flask Web開發入門、進階與實戰
- 算法大爆炸:面試通關步步為營
- INSTANT Weka How-to
- Functional Programming in JavaScript
- Amazon S3 Cookbook
- Active Directory with PowerShell
- 零基礎學Kotlin之Android項目開發實戰
- Visual Studio Code 權威指南
- Java 9 Programming By Example
- Oracle實用教程
- Magento 2 Beginners Guide