Article directory
- Paradigm
- BCNF
- keep functional dependencies
- Among them, the functional dependency set F uses the minimum functional dependency set
- lossless connectivity
- Algorithms for Schema Decomposition
- A Decomposition Algorithm for Converting R to 3NF with Lossless Connectivity and Preserving Functional Dependency
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
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
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
- Write out functional dependencies that conform to [[3.4.3 Normal Form #3NF (usually)|3NF]]
- According to the functional dependency decomposition relationship, [[Keep Functional Dependency#Keep Functional Dependency|Keep Functional Dependency]]
- Remove duplicate decomposition relations, such as subset relations
- 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
- Find a decomposition of R preserving functional dependence p={R1,R2...,Rk]
- Determine whether p has lossless connectivity, if so, go to 4
- Let p = p U {X}, where X is a candidate key for R.
- After the decomposition is completed, p is output.