3.4.3 Paradigm, Algorithms Preserving Functional Dependency, Lossless Connectivity, Schema Decomposition

Paradigm

1NF

Collections, sequences, etc. cannot be used as attributes.

2NF

Non-key attributes and candidate keys cannot have partial dependencies
If the candidate code is a single attribute, it must be able to reach 2NF, only need to consider whether it reaches 3NF, etc.

3NF (usually)

Non-primary attributes and candidate keys cannot have transitive dependencies

BCNF

If the left ends of all functional dependencies are candidate codes, it is BCNF


keep functional dependencies

See if all the decomposed relationships can contain the attributes that each function depends on
insert image description here

C→B is not kept in p1, A→B is kept

Among them, the functional dependency set F uses the minimum functional dependency set



lossless connectivity

There is a relational schema R(U, F), the set of functional dependencies on it:
U={A,B,C}, F={A→B, C→B},
judge whether the following decomposition has lossless connectivity.
p1= {R1(AB), R2(AC)} p1= {R1(AB), R2(BC)}

Divided into two relations, there are two rows
and three elements, there are three columns
insert image description here

It can be seen from F that A can determine B, and the values ​​in column A are equal to a1, so the values ​​in column B can be equal to a2, and the row R2 is all a, and one row is all a, so there is lossless connectivity


Algorithms for Schema Decomposition

  1. Write out functional dependencies that conform to [[3.4.3 Normal Form #3NF (usually)|3NF]]
  2. According to the functional dependency decomposition relationship, [[Keep Functional Dependency#Keep Functional Dependency|Keep Functional Dependency]]
  3. Remove duplicate decomposition relations, such as subset relations
  4. Merge relationships with the same primary key
    ![[Schema Decomposition Algorithm.png]]

A Decomposition Algorithm for Converting R to 3NF with Lossless Connectivity and Preserving Functional Dependency

  1. Find a decomposition of R preserving functional dependence p={R1,R2...,Rk]
  2. Determine whether p has lossless connectivity, if so, go to 4
  3. Let p = p U {X}, where X is a candidate key for R.
  4. After the decomposition is completed, p is output.

Guess you like

Origin blog.csdn.net/qq_25887493/article/details/123789798