Three paradigms of data and what are the three major anti-paradigm

A: First talk about what are the three paradigms:


  1. The first paradigm (1NF): ensuring atomicity of each column (each column do not split)

  2. The second paradigm (2NF): paradigm on the basis of a first, non-primary field must rely on the main field (only one thing at a table)

  3. A third paradigm (3NF): on the basis of the second paradigm, eliminating dependence transfer

  Above all Mandarin, the design table for the first paradigm What does it mean to see Table 1-1

    

 

             1-1

  The above table clearly does not meet the user's first three paradigms Paradigm: Why data address field column is "China - Beijing"; this can be split can be split into the following table, why should we split it? when I statistical area classification, which obviously is not good statistics, we can change the form of table 1-2, which comply with the requirements of the first paradigm.

        

 

            1-2

 

   So what is the second paradigm, the second paradigm is based on the first paradigm (paradigm on the basis of the first non-primary field must depend on the main field, a table only one thing), see Table 1 -3

    

 

              1-3

  We are back and add a mathematics achievement, English achievement and family, and a series of fields, if so designed, then a table to meet all the fields needed for a project, are synthesized in a table (back plus unlimited field), so it is a mess, and also violates the second normal form

 

  So what is the third paradigm, the third paradigm based on the first paradigm above ( elimination of transitive dependencies ), see Table 1-4

    

             1-4

  We have an order form, there are number of stand-alone, and the total number of fields, but this should not have a total price, the total price is obtained by multiplying the unit price by the number, which does not comply with the third paradigm ( the elimination of transitive dependencies )) If there is no clear understanding, we look at table 1-5 and table 1-6

    

 

             1-5

    

 

             1-6

  In the user table, we correct for the user table only save a company id, our company name is derived this field, the business name should go to the table to inquire business, which obviously does not meet the third paradigm;

I: Say What is anti-three paradigms:

  Having three major paradigms, we tell you what is the paradigm of anti-three, took third paradigm, watching Table 1-7

    

 

   If we have tens of thousands of data, every time you have the data you want to query the total price of this property, we will calculate tens of thousands of times, this will obviously slow down the performance of service, Take 1-5 and Table 1 -6, we each user query time, echo time enterprise information, but also to query corporate table, so much a query, it will slow down server performance.

  To summarize it: three anti-paradigm is based on the third paradigm adjustment, there is no redundancy of the database may not be good database, sometimes in order to improve operational efficiency, it must reduce the standard paradigm, appropriate to retain redundant data. Rational design based on the needs of business database

  Note: The blog is part of the data from Jiang Su Chuanzhi podcast.

Guess you like

Origin www.cnblogs.com/shuxiaosheng/p/11588837.html