Quickly understand the three paradigms of database design in five minutes

Database design paradigm

What is the paradigm: In short, database design has a great relationship with the storage performance of data and the operation of data by developers. Therefore, the establishment of a scientific and standardized database needs to satisfy some

Standardized to optimize the data storage method. These specifications can be called paradigms in relational databases.

What are the three paradigms:

First normal form : When all the attributes of the relational model R can no longer be decomposed into more basic data units , it is said that R satisfies the first normal form, which is abbreviated as 1NF. Satisfying the first normal form is the minimum requirement for the standardization of the relational model. Otherwise, there will be many basic operations that cannot be realized in such a relational model.

Second normal form : If the relational model R satisfies the first normal form, and all non-primary attributes of R are completely dependent on each candidate key attribute of R, it is said that R satisfies the second normal form, which is abbreviated as 2NF.

Third normal form : Let R be a relational model that satisfies the conditions of the first normal form, and X is any attribute set of R. If X is non-transitively dependent on any candidate keyword of R, then R is said to meet the third normal form, which is abbreviated as 3NF .

Note: The relationship is essentially a two-dimensional table, in which each row is a tuple, and each column is an attribute.

Examples to understand

The first paradigm understanding : must not include the relationship of repeated groups, that is, each column is an inseparable atomic item.

If the following table has sub-items (senior titles), it does not meet the first normal form

The first paradigm method of transforming from non-standardization to standardization is very simple, just expand the table horizontally and vertically. Expand the senior professional title horizontally to get a table structure that satisfies the first paradigm.

Second paradigm understanding : to meet the attributes in the first paradigm data, there is no relationship that depends on the main code

For example, in the relational model (employee number, name, job title, project number, project name), employee number -> name, employee number -> job title, and project number -> project name. Obviously the dependency relationship does not satisfy the second normal form. The commonly used solution is the difference table, such as splitting into the employee information table and the project information table

Understanding of the third paradigm: The relational model satisfies the second paradigm, and all non-primary attributes have no transitive dependence on any candidate keywords .

For example, a table structure such as Student table (student number, name, age, gender, college, college address, college phone) has the above relationship. Student ID --> Home University --> (School Address, School Phone). We should disassemble it as follows:

(Student ID, name, age, gender, home institution) - (home institution, institution address, institution telephone).

At last:

The three paradigms are just the basic concepts of general database design, and a database with less redundancy and a reasonable structure can be established. If there are special circumstances, of course, they must be treated specially. The most important thing in database design is to look at requirements and performance, demand>performance>table structure. Therefore, we can not blindly pursue the paradigm to establish a database.

 

Guess you like

Origin blog.csdn.net/qq_27828675/article/details/109290817