当前位置:网站首页>Three paradigms of database design
Three paradigms of database design
2022-07-04 08:14:00 【Vivien_ oO0】
brief introduction
In order to establish less redundancy , A well structured database , Certain rules must be observed when designing the database , In relational databases, this rule is the paradigm . A paradigm is a collection of relational patterns that conform to a certain level . The relationship in relational database must meet certain requirements , That is to meet different paradigms .
At present, there are six paradigms in relational database , Generally speaking, as long as the database meets the third paradigm , And what we often use is what we call the three paradigms , First normal form , Second and third paradigms .
First normal form
Atomicity 、 Indivisibility
What does that mean ?
It requires that every field in your table cannot be further split , Are the smallest data units .
If there is the following student information form
Student information sheet
Student number | full name | Home address | College number | The name of the College | Dormitory number | Dormitory type | The number of beds in the dormitory |
---|---|---|---|---|---|---|---|
001 | Zhang San | Xi'an, Shaanxi Province | 100001 | College of science | 222 | standard room | 4 |
002 | Li Si | Xianyang City, Shaanxi Province | 100002 | school of computing | 333 | Non standard room | 6 |
003 | Wang Wu | Baoji City, Shaanxi Province | 100003 | School of Marxism | 666 | standard room | 4 |
The address column can be further split into provinces 、 City So this table does not conform to the first normal form
Second normal form
Second normal form It is required that on the premise of ensuring the first paradigm , requirement Each column should be related to the primary key , It cannot only be related to a part of the primary key , Require entity uniqueness .
For example, the following table :
Student number | full name | College number | The name of the College | Dormitory number | Dormitory type | The number of beds in the dormitory |
---|---|---|---|---|---|---|
001 | Zhang San | 100001 | College of science | 222 | standard room | 4 |
002 | Li Si | 100002 | school of computing | 333 | Non standard room | 6 |
003 | Wang Wu | 100003 | School of Marxism | 666 | standard room | 4 |
The primary key is student number, college number and dormitory number
full name 、–> Student number
The name of the College —> College number
Dormitory type 、 The number of beds in the dormitory —> Dormitory number
The above is only partially dependent So it violates the second paradigm So you should split the table
Student number | full name | College number | Dormitory number |
---|---|---|---|
001 | Zhang San | 100001 | 222 |
002 | Li Si | 100002 | 333 |
003 | Wang Wu | 100003 | 666 |
College number | The name of the College |
---|---|
100001 | College of science |
100002 | school of computing |
100003 | School of Marxism |
Dormitory number | Dormitory type | The number of beds in the dormitory |
---|---|---|
222 | standard room | 4 |
333 | Non standard room | 6 |
666 | standard room | 4 |
The primary key of the first table is student number , The primary key of the second table is the college number , The primary key of the table in Chapter 3 is dormitory number
This design makes the database clearer , If you need to find the name of the College , Check directly in the college table
Third normal form
The third paradigm requires Each column is directly related to the primary key column Not indirectly , That is, limit the redundancy of columns
.
Dormitory number | Dormitory type | The number of beds in the dormitory |
---|---|---|
222 | standard room | 4 |
333 | Non standard room | 6 |
666 | standard room | 4 |
Like the above table . Dormitory number —> Dormitory type —> The number of beds in the dormitory
From these dependencies, we can choose the dormitory number —> The number of beds in the dormitory
Dormitory No —> The number of beds in the dormitory is called transmission dependence
So the table should be subdivided again
Dormitory number | Dormitory type |
---|---|
222 | standard room |
333 | Non standard room |
666 | standard room |
Dormitory type | The number of beds in the dormitory |
---|---|
standard room | 4 |
Non standard room | 6 |
standard room | 4 |
In this way, there is no indirect dependency .
Be careful : The repeated occurrence of primary keys and foreign keys in multiple tables does not belong to data redundancy , The repetition of non key fields is data redundancy .
边栏推荐
- zabbix 5.0监控客户端
- 弈柯莱生物冲刺科创板:年营收3.3亿 弘晖基金与淡马锡是股东
- C#实现一个万物皆可排序的队列
- Leetcode(215)——数组中的第K个最大元素
- L1-028 judging prime number (10 points)
- [go basics] 1 - go go
- How to get bytes containing null terminators from a string- c#
- Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service
- Ecole bio rushes to the scientific innovation board: the annual revenue is 330million. Honghui fund and Temasek are shareholders
- R language ggplot2 visualization: ggplot2 visualization grouping box diagram, place the legend and title of the visualization image on the top left of the image and align them to the left, in which th
猜你喜欢
Système de surveillance zabbix contenu de surveillance personnalisé
DM8 uses different databases to archive and recover after multiple failures
Preliminary study on temporal database incluxdb 2.2
谷歌官方回应:我们没有放弃TensorFlow,未来与JAX并肩发展
如何用MOS管来实现电源防反接电路
Heap concept in JVM
Conversion of yolov5 XML dataset to VOC dataset
Moher College webmin unauthenticated remote code execution
Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
Question 49: how to quickly determine the impact of IO latency on MySQL performance
随机推荐
Is l1-029 too fat (5 points)
C # implements a queue in which everything can be sorted
Chrome is set to pure black
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
Snipaste convenient screenshot software, which can be copied on the screen
L1-023 output gplt (20 points)
[go basics] 1 - go go
Scanf read in data type symbol table
C#实现一个万物皆可排序的队列
Leetcode 23. Merge K ascending linked lists
zabbix監控系統自定義監控內容
力扣今日题-1200. 最小绝对差
【性能測試】一文讀懂Jmeter
[test de performance] lire jmeter
ZABBIX monitoring system deployment
Need help resetting PHP counters - PHP
墨者学院-Webmin未经身份验证的远程代码执行
The text box displays the word (prompt text) by default, and the text disappears after clicking.
Unity text superscript square representation +text judge whether the text is empty
@Role of pathvariable annotation