Database design Paradigm
What is a paradigm: in short, database design has a great relationship to the data storage performance, as well as the developer's ability to manipulate the data. So the establishment of a scientific, normative database is needed to meet some
To optimize the way data data is stored. In a relational database, these specifications can be called paradigms.
What are the three main paradigms:
The first paradigm: when all the properties of the relational mode R are not decomposed into more basic units of data, the R is satisfied with the first paradigm, and précis-writers is 1NF. Satisfying the first paradigm is the minimum to normalize the relationship pattern
Otherwise, there will be a lot of basic operations that cannot be achieved in such a relational pattern.
The second paradigm: if the relationship pattern R satisfies the first paradigm, and all non-principal properties of R are completely dependent on each candidate key attribute of R, the R satisfies the second normal form and précis-writers is 2NF.
The third paradigm: set R is a relational pattern satisfying the first paradigm condition, X is any set of properties of R, if x non-transitive relies on any one of R's candidate keywords, and R satisfies the third normal form, précis-writers is 3NF.
Note: A relationship is essentially a two-dimensional table in which each row is a tuple, and each column is an attribute
Understanding the three main paradigms
First Paradigm
1. Each column property is an attribute value that cannot be re-divided, ensuring the atomicity of each column
2. The properties of the two columns are similar or similar, and the same columns are merged as possible to ensure that no redundant data is generated.
If the demand knows the province and classifies it, then it is clear that the first table is not easy to meet the requirements and does not conform to the first paradigm.
It is clear that the first table structure not only satisfies the requirements of a sufficient number of items, but also creates redundancy in the case of an item. Also does not conform to the first paradigm.
Second Paradigm
The data for each row can only be related to one of the columns, that is, a single row of data does one thing. As long as there is data duplication in the data column, you need to split the table.
A person to order a few rooms at the same time, will come out an order number of data, this way contacts are duplicated, resulting in data redundancy. We should tear him apart.
This enables a single piece of data to do one thing without complex relational logic. Update maintenance of table data is also easier to operate.
Third Paradigm
Data cannot have a transitive relationship, that is, no attribute has a direct relationship with the primary key, not an indirect one. Like: A-->b-->c attributes have such relationships that do not conform to the third paradigm.
such as Student table (school number, name, age, gender, institution, institution address, college phone)
Such a table structure, there is the above relationship. Study number------(university address, college phone)
Such a table structure, we should take apart, as follows.
(Student number, name, age, gender, institution)--(institution, institution address, school phone)
At last:
The three paradigms are only the basic concept of general design database, and can build a database with smaller redundancy and reasonable structure. If there is a special case, of course, to special treatment, database design is most important to look at requirements and performance, requirements > Performance > table structure. So we can't blindly pursue the paradigm to build a database.
3 major paradigms of database design