当前位置:网站首页>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
边栏推荐
- Review the whole process of the 5th Polkadot Hackathon entrepreneurship competition, and uncover the secrets of the winning projects!
- Node の MongoDB Driver
- 2022年流动式起重机司机考试题库及模拟考试
- 【tcp】服务器上tcp连接状态json形式输出
- SqlServer定时备份数据库和定时杀死数据库死锁解决
- 数据类型、
- 9、 Disk management
- LSTM applied to MNIST dataset classification (compared with CNN)
- 分享.NET 轻量级的ORM
- uniapp
猜你喜欢
32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)
2022年化工自动化控制仪表考试试题及在线模拟考试
2022 mobile crane driver examination question bank and simulation examination
爬虫(9) - Scrapy框架(1) | Scrapy 异步网络爬虫框架
基于昇腾AI丨以萨技术推出视频图像全目标结构化解决方案,达到业界领先水平
The first product of Sepp power battery was officially launched
2022年危险化学品生产单位安全生产管理人员特种作业证考试题库模拟考试平台操作
Based on shengteng AI Aibi intelligence, we launched a digital solution for bank outlets to achieve full digital coverage of information from headquarters to outlets
Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
Go-3-第一个Go程序
随机推荐
Do you really understand the things about "prototype"? [part I]
2022 mobile crane driver examination question bank and simulation examination
Golang应用专题 - channel
BOM//
Bidirectional RNN and stacked bidirectional RNN
流程控制、
DOM//
中职组网络安全C模块全漏洞脚本讲解包含4个漏洞的脚本
【js学习笔记五十四】BFC方式
关于vray5.2怎么关闭日志窗口
磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
A mining of edu certificate station
SqlServer定时备份数据库和定时杀死数据库死锁解决
第五届 Polkadot Hackathon 创业大赛全程回顾,获胜项目揭秘!
关于vray 5.2的使用(自研笔记)(二)
Variables///
Nuxt//
运算符、、
Ad20 make logo
32: Chapter 3: development of pass service: 15: Browser storage media, introduction; (cookie,Session Storage,Local Storage)