当前位置:网站首页>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
边栏推荐
猜你喜欢
Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
双向RNN与堆叠的双向RNN
About the use of Vray 5.2 (self research notes)
Review the whole process of the 5th Polkadot Hackathon entrepreneurship competition, and uncover the secrets of the winning projects!
Do you really understand the things about "prototype"? [part I]
微信核酸检测预约小程序系统毕业设计毕设(6)开题答辩PPT
About the use of Vray 5.2 (self research notes) (II)
Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
Go语言-1-开发环境配置
关于vray 5.2的使用(自研笔记)
随机推荐
一次edu证书站的挖掘
Blockbuster: the domestic IDE is released, developed by Alibaba, and is completely open source!
【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
微信核酸检测预约小程序系统毕业设计毕设(8)毕业设计论文模板
Bracket matching problem (STL)
2022年T电梯修理操作证考试题及答案
2022 t elevator repair operation certificate examination questions and answers
中职组网络安全2021年江苏省省赛题目5套题目环境+解析全有需要的私信我
A usage example that can be compatible with various database transactions
LSTM applied to MNIST dataset classification (compared with CNN)
TSQL–标示列、GUID 、序列
脚手架开发进阶
跨页面通讯
LSTM应用于MNIST数据集分类(与CNN做对比)
Lazy loading scheme of pictures
在C# 中实现上升沿,并模仿PLC环境验证 If 语句使用上升沿和不使用上升沿的不同
Nuxt//
字符串、、
Go-2-Vim IDE常用功能
Data types ntext and varchar are incompatible in the not equal to operator - 95 small pang