当前位置:网站首页>6.2 normalization 6.2.6 BC normal form (BCNF) 6.2.9 normalization summary

6.2 normalization 6.2.6 BC normal form (BCNF) 6.2.9 normalization summary

2022-07-01 15:28:00 Miss people

6.2.6 BC normal form

 for instance

Take a chestnut : Relationship model STJ(S, T, J) in ,S Students ,T It means that the teacher ,J Indicates the course
semantics :
Suppose each teacher can teach only one course T → J
Each course is taught by several teachers , But a student takes a course , I chose a fixed teacher (S, J) → T
When a student chooses a teacher's course, the name of the selected course is determined (S, T) → J
T → J,(S, J) → T,(S, T) → J

  1. Candidate code :(S, J) and (S, T)
  2. S T J It's all primary properties
  3. There are no non primary attribute pairs Part of the function depends on and The transfer function depends on
  4. STJ ∈ 3NF

although STJ(S, T, J)∈3NF, There are exceptions such as addition, deletion and modification in the single throw , It is not an ideal relationship model
(1) Insertion exception
     If a teacher offers a course , But no students have yet taken , Then the relevant information cannot be stored in the database .
(2) Delete exception
     If all the students who take a course graduate , When deleting these student tuples , The new news that the corresponding teacher opened the course was also lost .
(3) Large data redundancy
     Although a teacher only teaches one subject , But every student tuple who elects the teacher's course records this information .
(4) The modification is complicated
     After a teacher changed the name of a course , All student tuples that have taken the teacher's course should be modified accordingly

  reason :
     Main attribute J Part of the function depends on the code (S, T). because T → J

  resolvent :
     The projection decomposition method is used , take STJ Decompose into two relational patterns :SJ(S,J);TJ(T,J)
 SJ The code of is (S,J),TJ The code of is T
In the decomposed relational schema There is no partial functional dependency and transfer functional dependency of any attribute on the code
He solved the above four problems :
(1)TJ The relationship can store the information of teachers whose courses have not been selected by students
(2) All the students who have taken a course have graduated , Just delete SJ Corresponding tuple of relation , Does not affect the TJ In the relationship, I want to use the information about the course offered by the teacher
(3) Information about the courses offered by each teacher is only available in TJ Store once in the relationship
(4) After a teacher changed the name of a course , Only need to modify TJ A corresponding tuple in the relationship can

 BCNF(Boyce Codd Normal Form) By Boyce and Codd Proposed , Than 3NF A step further . It is commonly believed BCNF It's the revised third paradigm , Sometimes called extended third paradigm .
 BCNF The definition of
Definition 6.8 Set the relational pattern R<U, F>∈1NF, If for R Every functional dependency of X→Y, And ⊉Y when ,X It must have a code , that R∈BCNF.
namely , In relation mode R<U, F> in , If Every determinant contains a code , be R∈BCNF
example :STJ(S, T, J)∈ 3NF, T→J,(S,J)→T,(S,T)→J
    SJ(S, J)∈ BCNF, SJ The code of is (S, J),all-key
    TJ(T, J)∈ BCNF, TJ The code of is T,T→J
 BCNF The nature of the relational pattern of

  1. All non primary attributes are fully function dependent on each code
  2. All primary attributes are also fully function dependent on each code that does not contain it
  3. No attribute completely depends on any set of non code attributes

  If the relationship pattern R∈BCNF, There must be R∈3NF
  If the relationship pattern R∈3NF, Not necessarily R∈BCNF( Like the one above STJ(S, T, J))
  If all relational schemas in a relational database belong to BCNF, So in function Depend on the range Inside , It has achieved a thorough decomposition of patterns , Reached the highest degree of standardization , Many problems of abnormal operation are eliminated .

  A relational model as long as it Components are inseparable data items , He is the standardized relationship model , But this is just the most basic normalization
  Degree of Standardization Too low The relationship model may not be a good description of the real world , There may be insertion exceptions 、 Delete exception 、 The modification is complicated 、 Data redundancy and so on , The solution is to standardize it , Convert to high-level paradigm
  A low-level paradigm of relational patterns , Through schema decomposition, it can be transformed into a set of relational schemas of several higher-level paradigms , This process is called Normalization of relationship pattern
  The normalization theory of relational database is a tool for database logic design

  The basic steps of relational schema normalization :
 The basic steps of relational schema normalization

  The basic idea of Standardization :
      Gradually eliminate inappropriate parts of data dependence , Make the relationship patterns in the pattern break down to a certain extent “ Separate ”
      use “ One thing at a time ” Pattern design principles
        ●  Let a relationship describe a concept 、 An entity or a connection between entities
        ●  If there is more than one concept, put it “ Separate out ”
      Standardization is essentially the simplification of concepts

原网站

版权声明
本文为[Miss people]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202152355286713.html