- 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.
- 從零開始構建企業級RAG系統
- 流量的秘密:Google Analytics網站分析與優化技巧(第2版)
- 國際大學生程序設計競賽中山大學內部選拔真題解(二)
- C語言程序設計習題解析與上機指導(第4版)
- Java EE框架整合開發入門到實戰:Spring+Spring MVC+MyBatis(微課版)
- PowerCLI Cookbook
- Mastering Swift 2
- Visual C
- 零基礎學Python數據分析(升級版)
- 網站構建技術
- OpenGL Data Visualization Cookbook
- Scratch3.0趣味編程動手玩:比賽訓練營
- GameMaker Essentials
- Go語言底層原理剖析
- 從0到1:HTML5 Canvas動畫開發