当前位置:网站首页>Decomposition relation model of the 2022 database of tyut Taiyuan University of Technology
Decomposition relation model of the 2022 database of tyut Taiyuan University of Technology
2022-07-06 13:12:00 【Lala Lulu^_^】
Question 4
Decompose relational patterns : Examination site : Basic functional dependencies of relational patterns 、 Relationship candidate key 、 Which paradigm does relationship belong to 、
What kind of relationship does it belong to NF、 decompose NF Pattern set (10 branch )
To master this topic, we must first master many basic concepts , Let's have a look , Just talk about what you want to test and what you will use to do the questions 、 I won't talk about the official words in the book , How to understand how to
One 、 Basic concepts
1、 Function dependency (FD): Functional dependency is the constraint relationship between attributes within the same relationship , That is to say R(A1,A2...) Medium lecture A1 And A2 And so on , For example, set the attribute student number to X、 The name is Y, Because the student number can decide the name , Then there are X decision Y Or say Y Depend on X, Write it down as :X->Y
2、FD Set ( Functional dependency set ): Will be multiple FD Put them together : Such as function dependency set F={A->B,B->C,A->C}, If there is a set, there will be implication , therefore F Logic implies X->Y, Write it down as :F|=X->Y
3、 Super key : Set a relationship R The property set of is U,X yes U Subset , If U Some of the properties in X Can decide U, namely X->U, So called X yes R A super key of ( Remove any attribute in the hyperkey ,X->U Still possible )
4、 Candidate key : In hyperkeys , If you remove any attribute in the hyperkey ,X->U Will not be established ( That is, there is no redundant attribute in the super key ), Then call this super key a candidate key
5、L class :F={A->B,B->C,A->C} All in -> Properties on the left , namely A、B
6、R class :F={A->B,B->C,A->C} All in -> Properties on the right , namely B、C
7、 Minimum functional dependency : The difficult words , Pass the examination , But I haven't seen it in the past two years , It's the test site , If you want to learn, you can read by yourself , I won't talk about it here
8、 Decomposition of relational patterns : We can R(A1,A2,A3,A4) Decompose into R1(A1,A2),R2(A3,A4)
9、 Completely function dependent : There are attribute sets X And property sets Y, Functional dependency X->Y, Get rid of X Any attribute in ,X->Y It doesn't work ( That is the X There is no redundant attribute in ), that Y The complete function depends on X, Otherwise, it is called local dependency
10、 Non primary property : It refers to the attribute that is not included in any candidate code in the relationship . for example : In relation —— Student ( Student number , full name , Age , Gender , class ) in , Main attribute 、 The candidate code is “ Student number ”, So the others “ full name ”、“ Age ”、“ Gender ”、“ class ” Can be called non primary property
( Similar to determining candidate keys , It's all about dependencies L Whether the class has redundant attributes )
11、 The transitive dependency that will appear in the big question : There are candidate keys X、 Non primary property Y、A, if X->Y,Y->A,Y!->X,A Do not belong to Y, So called X->A It's delivery dependency (A Delivery depends on X)
Two 、 The paradigm of relationship pattern
There is an inclusive relationship between paradigms :1NF contain 2NF contain 3NF contain BCNF
1、 First normal form (1NF)
As long as the relationship mode R(A1,A2...) All properties in A1、A2...... Are inseparable attributes , Are atomic properties , Then meet the first paradigm
To be dissatisfied with 1NF Relationship model of R, We're going to R Become satisfied 1NF Relationship model of : Or decompose its non atomic properties , Or decompose its relationship pattern , You are satisfied with the general questions 1NF
2、 Second normal form (2NF)
If the relational pattern R yes 1NF, And each non primary attribute is completely functionally dependent on candidate keys , be R For the second paradigm (2NF)
Judge whether it is 2NF: Put the candidate key ( The common candidate keys in big questions generally include 2 Attributes ) Determine each non primary attribute in turn , Judge whether the function depends on the right (L class ) Whether there are redundant attributes , If there is no , It's in line with 2NF , On the contrary, it does not meet
To be dissatisfied with 2NF Relationship model of R, We're going to R Become satisfied 2NF Relationship model of : In fact, it is a simple classification , We put R Decompose into R1、R2....... Non primary attributes that will be redundant with candidate keys 、 And its corresponding candidate keys are placed in R1 in ; Non primary attributes that will not be redundant with candidate keys 、 And its corresponding candidate keys are placed in R2 in . Let's take an example to understand :
example : Set a relationship R( Customer number , The number of the item purchased , Number , Name of the manufacturer , Business address ), Judge R Whether to belong to 2NF, If R Do not belong to 2NF, Please put R Decompose into 2NF Pattern set
Explain : The candidate key is the customer number , The number of the item purchased , Yes ( Customer number , The number of the item purchased )->( Name of the manufacturer , Business address ), Because of a single attribute “ The number of the item purchased ” You can decide “ Name of the manufacturer , Business address ”, Therefore, there is a case that non primary attributes locally depend on candidate keys ,R Do not belong to 2NF
| take R Decompose into 2NF Pattern set thinking ( Don't write on the paper , Write only on scratch paper ) |
![]() |
take R Decompose into 2NF The pattern set is :
R1( The number of the item purchased , Name of the manufacturer , Business address )
R2( Customer number , The number of the item purchased , Number )
3、 Third normal form (3NF)
Brush up on :11、 The transitive dependency that will appear in the big question : There are candidate keys X、 Non primary property Y、A, if X->Y,Y->A,Y!->X,A Do not belong to Y, So called X->A It's delivery dependency (A Delivery depends on X)
If the relational pattern R yes 2NF, And each non primary attribute does not rely on candidate keys , be R For the third paradigm (3NF)
Judge whether it is 3NF: By definition , See if there is a phenomenon that non primary attribute transmission depends on candidate keys in the relational pattern .
To be dissatisfied with 3NF Relationship model of R, We're going to R Become satisfied 3NF Relationship model of :
If in R(X,Y,A,B,C) in , The candidate key is X、 Non primary attribute is Y、A、B、C, There is X->Y,Y->A,Y!->X,A Do not belong to Y( namely X->A,A Delivery depends on X), Then just put R Decompose into R1(X,Y,B,C),R2(Y,A) To satisfy 3NF, It can be understood as R1 Only the Y,R2 Only two non primary attributes that are transitively dependent on candidate keys are retained Y,A
Look at an example to understand
example : There's a relational model : readers ( Reader number , full name , Company , Address ), Each unit has only one address , Please normalize it into 3NF
Explain :
From the meaning of the question : Reader number -> Company -> Address
readers 1( Reader number , full name , Company ) Only the address at the end of the delivery position is removed
Company ( Company , Address ) Only two non primary attributes that are transitively dependent on candidate keys are retained : Company , Address
The real question :

边栏推荐
- Error: symbol not found
- 初识C语言(上)
- [algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix
- Code example of MATLAB reading GNSS observation value o file
- Abstract classes and interfaces
- TYUT太原理工大学2022软工导论考试题型大纲
- Tyut Taiyuan University of technology 2022 introduction to software engineering examination question outline
- Introduction pointer notes
- All in one 1405: sum and product of prime numbers
- 2022 National Games RE1 baby_ tree
猜你喜欢

十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩

继承和多态(上)
![[算法] 剑指offer2 golang 面试题1:整数除法](/img/e6/f17135207b3540ec58e5a9eed54220.png)
[算法] 剑指offer2 golang 面试题1:整数除法

架构师怎样绘制系统架构蓝图?
![[算法] 剑指offer2 golang 面试题4:只出现一次的数字](/img/f7/23ffc81ec8e9161c15d863c1a67916.png)
[算法] 剑指offer2 golang 面试题4:只出现一次的数字
![[algorithme] swordfinger offer2 golang question d'entrevue 2: addition binaire](/img/c2/6f6c3bd4d70252ba73addad6a3a9c1.png)
[algorithme] swordfinger offer2 golang question d'entrevue 2: addition binaire

3月15号 Go 1.18 正式版发布 了解最新特色以及使用方法

Alibaba cloud microservices (II) distributed service configuration center and Nacos usage scenarios and implementation introduction
![[algorithm] sword finger offer2 golang interview question 6: sum of two numbers in the sorting array](/img/d5/4bda133498f71ae9fd7a64c6cba8f0.png)
[algorithm] sword finger offer2 golang interview question 6: sum of two numbers in the sorting array

阿里云一面:并发场景下的底层细节 - 伪共享问题
随机推荐
How do architects draw system architecture blueprints?
Chromatic judgement bipartite graph
Iterable、Collection、List 的常见方法签名以及含义
阿里云微服务(三)Sentinel开源流控熔断降级组件
雇佣收银员【差分约束】
165. Compare version number - string
Heap sort [handwritten small root heap]
[算法] 剑指offer2 golang 面试题8:和大于或等于k的最短子数组
TYUT太原理工大学2022软工导论考试题型大纲
121道分布式面试题和答案
【话题终结者】
染色法判定二分图
C code implementation of robust estimation in rtklib's pntpos function (standard single point positioning spp)
[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity
一文搞定 UDP 和 TCP 高频面试题!
[algorithm] sword finger offer2 golang interview question 7: 3 numbers with 0 in the array
Introduction and use of redis
167. Sum of two numbers II - input ordered array - Double pointers
Design a key value cache to save the results of the most recent Web server queries
MySQL shutdown is slow
