Database-BC Paradigm (BCNF)

Source: Internet
Author: User

BC Paradigm (BCNF)
关系模式R<U,F>∈1NF,若X→Y且Y ? X时X必包含码,则R<U,F> ∈BCNF。这个定义表明,如果非平凡的FD X→Y中X不包含码,那么Y必定传递依赖于候选键,因此R不是BCNF模式。等价于:每一个决定属性因素都包含码
如果关系模式R是1NF,且每个属性(包括主属性和非主属性)都不传递依赖于R的候选码,那么称R是BCNF的模式。
若R∈BCNF 所有非主属性对每一个码都是完全函数依赖所有的主属性对每一个不包含它的码,也是完全函数依赖没有任何属性完全函数依赖于非码的任何一组属性R ∈BCNF                R ∈3NF
定理:如果R是BCNF模式,那么R也是3NF模式。证明:设R是BCNF,但不是3NF,那么R上必存在传递依赖X→Y,Y→A,这里X是R的码,A∈Y, Y→X。显然Y不包含R的码,否则Y→X也成立。因此Y→A违反了BCNF的定义,与假设R是BCNF矛盾。从而定理得证。
[例5] 关系模式C(Cno,Cname,Pcno)C∈3NFC∈BCNF[例6]  关系模式S(Sno,Sname,Sdept,Sage)假定S有两个码Sno,SnameS∈3NF。S ∈ BCNF
[例7]关系模式SJP(S,J,P)函数依赖:(S,J)→P;(J,P)→S(S,J)与(J,P)都可以作为候选码,属性相交SJP∈3NF,SJP∈BCNF
[例8]在关系模式STJ(S,T,J)中,S表示学生,T表示教师,J表示课程。函数依赖:          (S,J)→T,(S,T)→J,T→J(S,J)和(S,T)都是候选码
Multi-valued dependency

[Example 9] A course in a school is taught by multiple teachers who use the same set of reference books. Each instructor can teach multiple courses, each of which can be used for multiple courses.
Teaching∈bcnf

Teaching has a unique candidate code (C,T,B), which is the full code
Problems in the teaching model
(1) Large redundancy of data
(2) Complicated insert operation
(3) Complex delete operation
(4) Complicated modification operation

 设R(U)是一个属性集U上的一个关系模式, X、 Y和Z是U的子集,并且Z=U-X-Y。关系模式R(U)中多值依赖 X→→Y成立,当且仅当对R(U)的任一关系r,给定的一对(x,z)值,有一组Y的值,这组值仅仅决定于x值而与z值无关例  B)

Another equivalent formalized definition of multi-valued dependency:

  在R(U)的任一关系r中,如果存在元组t,s 使得t[X]=s[X],那么就必然存在元组 w,v? r,(w,v可以与s,t相同),使得w[X]=v[X]=t[X],而w[Y]=t[Y],w[Z]=s[Z],v[Y]=s[Y],v[Z]=t[Z](即交换s,t元组的Y值所得的两个新元组必在r中),则Y多值依赖于X,记为X→→Y。 这里,X,Y是U的子集,Z=U-X-Y。

Trivial multivalued dependency and non-trivial multi-valued dependency
If X→→y, and z=φ, is said
X→→y is a trivial multi-valued dependency
Otherwise called X→→y is a non-trivial multi-valued dependency
[Example 10] Relationship mode WSC (w,s,c)
W means warehouse, S represents custodian, C denotes commodity
Assuming that each warehouse has several custodians, there are several kinds of goods
All items in the warehouse where each custodian is kept
Each product is kept by all custodians

Multi-valued dependency property

(1) Multi-valued dependence has symmetry
If x→→y, then x→→z, of which z=u-x-y
(2) Multi-valued dependency has transitivity
If x→→y,y→→z, then x→→z–y
(3) function dependency is a special case of multivalued dependency.
If x→y, then x→→y.
(4) If x→→y,x→→z, then x→→y? Z.
(5) If x→→y,x→→z, then x→→y∩z.
(6) If x→→y,x→→z, then x→→y-z,x→→z-y.

The difference between a multivalued dependency and a function dependency

(1) The validity of multivalued dependencies is related to the scope of the attribute set
(2)
If the function dependent x→y is set on R (U), then for any y '? Y all have x→y ' established
Multi-valued dependent x→→y if it is set on R (U), it cannot be asserted for any y '? Y has X→→y ' established

4NF
关系模式R<U,F>∈1NF,如果对于R的每个非平凡多值依赖X→→Y(Y ? X),X都含有码,则R∈4NF。如果R ∈ 4NF, 则R ∈ BCNF不允许有非平凡且非函数依赖的多值依赖允许的非平凡多值依赖是函数依赖
例: Teaching(C4NF    存在非平凡的多值依赖C→→T,且C不是码用投影分解法把Teaching分解为如下两个关系模式:                       CT(C4NF                   CB(C4NF     CC→→B是平凡多值依赖

The normalization theory of relational database is the tool of database logical design

Objective: To avoid inserting, deleting, modifying complex, data redundancy

Basic idea: Phasing out inappropriate portions of data dependencies
Essence: The single of the concept

We can't say that the higher the degree of normalization, the better the relationship pattern.
In designing the database schema structure, we must make further analysis to the real-world actual situation and user application requirements, and determine a suitable model that can reflect the real world.
The normalization step above can be terminated at any one of these steps

Database-BC Paradigm (BCNF)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.