The normalization process of relational schema is realized by decomposing relational schema. The lower-level relational model is decomposed into several higher-level relational models. This decomposition is not unique.
Normalization is modal decomposition, the principle of modal decomposition is equivalent to the original mode, and the standard of modal decomposition is:
Pattern decomposition has lossless connectivity.
Pattern decomposition can maintain functional dependence.
Example: the process of relationship standardization
First normal form (1NF): If every component of a relational schema is an inseparable data item, that is, its domain is a simple domain, then this relational schema is first normal form.
Example: Students' resumes and course selection data are designed as relational model students, which are expressed as:
Students (SNO, name, age, gender, class, department number, department name, CNO,
CNAME, score, credit)
Let this relational schema satisfy the following functional dependencies:
f = { SNO->; Snum, SNO-& gt;; Age, SNO-& gt;; Sex, SNO-& gt;; CLASS,CLASS-& gt; Depno? DEPTNO->; CNO·DEPTNAME-& gt; SNO CNAME。 CNO->; Score, CNO-& gt;; Credit}
Because the domain corresponding to each attribute of this relationship model is a simple domain, that is, its domain values are inseparable, which conforms to first normal form's definition, so the student relationship model is first normal form.
The second normal form (2NF): What about the relational model R? 1NF, and each non-principal complete function depends on the code, which is called r? 2NF .
Analyze the relationship model. Student, is it 2NF?
Attribute group (SNO, CNO) is the code related to students.
For example, SNAME is a non-primary attribute, and according to the code, it has the following characteristics: SNO. CNO? SNAME
According to the set of known functional dependencies in the student relationship model, the following functional dependencies hold: SNO? SNAME
So, SNO. CNO? SNAME, SNAME is a partial functional dependence on code. In the same way, it can be concluded that in addition to the SCORE attribute, other non-main attributes are also partially dependent on the code. So the student relationship model is not 2NF.
What's wrong with the correspondence when the relation pattern r is 1NF instead of 2NF? When we analyze the student relationship model, we will encounter the following problems:
There are a lot of redundant data: when a student is studying multiple courses, his personnel information appears repeatedly.
According to the integrity rules of the relational model, the attribute value of the primary code cannot be empty. Then, when freshmen have just entered school and haven't taken any classes, tuples can't be inserted into the relationship. This situation is called inserting an exception.
Also delete the exception, and the information will be lost.
The solution to the above problems is to decompose a large pattern into several small patterns, and the decomposed patterns can meet the requirements of higher-level paradigms.