当前位置:网站首页>Paradigm in database: first paradigm, second paradigm, third paradigm
Paradigm in database: first paradigm, second paradigm, third paradigm
2022-07-05 10:53:00 【It was delicious when I was young】
Tuples : A line in the table
code : A column in the table
Candidate code : can Unique identification , Such as through ( Id card number ) perhaps ( School , class , Student number ) Can uniquely identify a person ; Main attribute : Attributes that have appeared in the candidate code
Main code : Also called primary key , Choose a boss from the candidate code
Foreign code is also called foreign key . If An attribute in a relationship
yes The main code in another relationship
Then this attribute is foreign code
First normal form , Second normal form , Super simple introduction of the third paradigm
First normal form : Can not be further divided
For example, there are two attributes in a table :
company 、 goods ( name 、 Number )
, However, the commodity can be identified by its name 、 Quantity means , Do not conform to the , andcompany 、 name 、 Number
accord with
Second normal form : Based on the first paradigm , Eliminate partial dependence
The order number | Product number | Product quantity | Product discounts | product price | Order amount | The order time |
---|---|---|---|---|---|---|
10001 | 25 | 100 | 0.9 | 9 | 5000 | 2022-07-22 |
10001 | 26 | 200 | 0.8 | 9 | 7000 | 2022-07-23 |
book single Number 、 production product Number → production product Count The amount 、 production product fold buckle 、 production product price grid book single Number → book single gold forehead 、 book single when between The order number 、 Product number \to Product quantity 、 Product discounts 、 product price \\ The order number \to Order amount 、 The order time book single Number 、 production product Number → production product Count The amount 、 production product fold buckle 、 production product price grid book single Number → book single gold forehead 、 book single when between
‘ The order number ’ and ‘ Product number ’ Is the primary key of the table ( Main code ), These two fields together determine ‘ Product quantity ‘ ’ Product discounts ‘ ’ product price ‘ ,
and ‘ Order amount ’ and ‘ The order time ’ Only by ‘ The order number ’ decision , Not by Primary key (‘ The order number ’ and ‘ Product number ’) Joint decision , therefore ‘ Order amount ’ and ‘ The order time ’ yes Depends in part on the primary key
Correct version
The order number | Product number | Product quantity | Product discounts | product price |
---|---|---|---|---|
10001 | 25 | 100 | 0.9 | 9 |
10001 | 26 | 200 | 0.8 | 9 |
The order number | Order amount | The order time |
---|---|---|
10001 | 5000 | 2022-07-22 |
10001 | 7000 | 2022-07-23 |
Third normal form : Based on the second paradigm , Eliminate delivery dependency
ID number | full name | Gender | Age |
---|---|---|---|
34666666666 | Zhang San | male | 22 |
body Share Prove → surname name → sex other 、 year age Id card \to full name \to Gender 、 Age body Share Prove → surname name → sex other 、 year age
“ Gender ” and “ Age ” Although indirect dependence ‘ ID number ’, but Directly dependent on Yes. “ full name ”, Correct version
ID number | full name |
---|---|
34666666666 | Zhang San |
full name | Gender | Age |
---|---|---|
Zhang San | male | 22 |
The transfer function depends on : body Share Prove → surname name → sex other 、 year age but yes sex other 、 year age ↛ surname name ↛ body Share Prove Id card \to full name \to Gender 、 Age ~~~~~~ however ~~~~~~ Gender 、 Age \not\to full name \not\to Id card body Share Prove → surname name → sex other 、 year age but yes sex other 、 year age → surname name → body Share Prove
边栏推荐
- Coneroller执行时候的-26374及-26377错误
- LSTM应用于MNIST数据集分类(与CNN做对比)
- 中职组网络安全C模块全漏洞脚本讲解包含4个漏洞的脚本
- 正则表达式
- [可能没有默认的字体]Warning: imagettfbbox() [function.imagettfbbox]: Invalid font filename……
- Common functions of go-2-vim IDE
- The first product of Sepp power battery was officially launched
- 数组、、、
- 9、 Disk management
- 磨礪·聚變|知道創宇移動端官網煥新上線,開啟數字安全之旅!
猜你喜欢
Basic testing process of CSDN Software Testing Introduction
csdn软件测试入门的测试基本流程
【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
关于vray 5.2的使用(自研笔记)
2022 t elevator repair operation certificate examination questions and answers
双向RNN与堆叠的双向RNN
赛克瑞浦动力电池首台产品正式下线
【广告系统】Parameter Server分布式训练
微信核酸检测预约小程序系统毕业设计毕设(8)毕业设计论文模板
LSTM应用于MNIST数据集分类(与CNN做对比)
随机推荐
Honing · fusion | know that the official website of Chuangyu mobile terminal is newly launched, and start the journey of digital security!
在C# 中实现上升沿,并模仿PLC环境验证 If 语句使用上升沿和不使用上升沿的不同
【DNS】“Can‘t resolve host“ as non-root user, but works fine as root
函数///
DOM//
Coneroller执行时候的-26374及-26377错误
Buried point 111
一个可以兼容各种数据库事务的使用范例
Go-3-the first go program
Node の MongoDB Driver
[vite] 1371 - develop vite plug-ins by hand
中职组网络安全C模块全漏洞脚本讲解包含4个漏洞的脚本
Web3 Foundation grant program empowers developers to review four successful projects
SqlServer定时备份数据库和定时杀死数据库死锁解决
How can gbase 8C database view the login information of the login user, such as the date, time and IP of the last login authentication?
beego跨域问题解决方案-亲试成功
括号匹配问题(STL)
LSTM applied to MNIST dataset classification (compared with CNN)
Go project practice - Gorm format time field
Sqlserver regularly backup database and regularly kill database deadlock solution