What is a paradigm: In short, database design has a great influence on the storage performance of data and the operation of data by developers. relation. Therefore, establishing a scientific and standardized database requires meeting some
specifications to optimize the data storage method. In relational databases these specifications can be called paradigms.
What are the three major paradigms:
First normal form: When all attributes of the relational schema R cannot be decomposed into more basic data unit, R is said to satisfy the first normal form, abbreviated as 1NF. Meeting the first normal form is the minimum requirement for the standardization of a relational model. Otherwise, many basic operations will not be implemented in such a relational model.
Second Normal Form: If the relational pattern R satisfies the first normal form, and all non-primary attributes of R are completely dependent on each candidate key attribute of R, R is said to satisfy the second normal form. , abbreviated as 2NF.
Third normal form: Suppose R is a relational schema that satisfies the conditions of the first normal form, and X is any attribute set of R. If X non-transitively depends on any candidate keyword of R , said R satisfies the third normal form, abbreviated as 3NF.
Note: The
relationship is essentially a two-dimensional table, Each row is a tuple, and each column is an attributeUnderstand the three major paradigms
1. The attributes of each column are attribute values that cannot be subdivided, ensuring the atomicity of each column. 2. The attributes of the two columns are close or similar or the same. Try to merge columns with the same attributes to ensure that no redundant data is generated.
If you need to know which province and city and classify them, then obviously the first table is not What is easy to satisfy needs does not conform to the first paradigm. Obviously, the first table structure not only cannot meet the requirements of enough items, but also creates redundancy when there are few items. It is also inconsistent with the first paradigm.Second Normal Form
Each row of data can only be related to one of the columns, that is, one row of data can only do one thing. Whenever data duplication occurs in a data column, the table must be split.
##If a person books several rooms at the same time, he will come out There are multiple pieces of data for one order number, so the contacts are all repeated, which will cause data redundancy. We should take him apart.
#In this way, a piece of data can do one thing without complicated relationship logic. At the same time, it is easier to update and maintain table data.
Third Normal Form
Data cannot have a transitive relationship, that is, no attribute is directly related to the primary key. Not an indirect relationship. Such a relationship between attributes like: a-->b-->c does not conform to the third normal form. For example, the Student table (student number, name, age, gender, school, school address, school phone number) Such a table structure has the above relationship. Student ID --> School --> (school address, school phone number)
We should disassemble a table structure like this, as follows.
(student number, name, age, gender, school)--(school, school address, school phone number)
Finally:
The three major paradigms are just the basic concepts of general database design, which can build a database with less redundancy and reasonable structure. If there are special circumstances, of course they must be treated specially. The most important thing in database design is demand and performance, demand > performance > table structure. Therefore, we cannot blindly pursue the paradigm to build a database.
The above is the detailed content of Understand the three major paradigms of database design. For more information, please follow other related articles on the PHP Chinese website!