Database three paradigm, easy to understand _php tutorial

Source: Internet
Author: User
Online collected a lot about the database paradigm understanding of the article, are thousands of law a copy and paste, even examples are exactly the same, please a little creative not to go on, I write a personal understanding of the three-paradigm article. If there is an incorrect understanding, please contact me: 279537592#qq.com (#=>@)

Official definition: First paradigm (1NF): A field in a database table is a single attribute and cannot be divided.
My understanding: The first paradigm does not have to say, as long as the relational database satisfies the first paradigm

Official definition: Second paradigm (2NF): A partial function dependency of a non-critical field in a database table on any of the candidate key fields
My understanding: In the second paradigm, the combination of the primary key (AB) "Annotated: Also called composite primary key" inside a or B and other fields can not have a combination of repetition, in order to solve this problem, it is common practice that we do not have to combine the primary key, add an ID, as a single primary key to meet the second paradigm. If you do not want to add an ID, please satisfy the combination of a or b in the combined primary key (AB) and the other fields cannot exist.
For example, the combination of a and field C in a composite primary key is not satisfied with the second normal form.
+------------+-----------+-------------------+
PK PK Row
+------------+-----------+-------------------+
A B C
+------------+-----------+-------------------+
A D C
+------------+-----------+-------------------+
A E C
+------------+-----------+-------------------+

Instead of satisfying the second paradigm (but not satisfying the third paradigm, field A and field C are combined duplicates):
+---------+------------+-----------+-------------------+
PK Row, Row row
+---------+------------+-----------+-------------------+
1 A B C
+---------+------------+-----------+-------------------+
2 A D C
+---------+------------+-----------+-------------------+
3 A E C
+---------+------------+-----------+-------------------+

Official definition: The third paradigm (3NF): On the basis of the second paradigm, if there is no non-critical field in the data table the transfer function dependency on either of the candidate key fields conforms to the third paradigm.
My understanding: In the third paradigm, there can be no combination of fields and fields
If the third normal form is not satisfied, field A and field C are combined repeatedly
+---------+------------+-----------+-------------------+---------------+
PK Row row, row row
+---------+------------+-----------+-------------------+---------------+
1 A B C F
+---------+------------+-----------+-------------------+---------------+
2 A D C G
+---------+------------+-----------+-------------------+---------------+
3 A E C K
+---------+------------+-----------+-------------------+---------------+

Instead, this satisfies the third paradigm:
Table 1
+---------+------------+-----------+
PK Row Row
+---------+------------+-----------+
1 A B
+---------+------------+-----------+
2 A D
+---------+------------+-----------+
3 A E
+---------+------------+-----------+
and table 2
+---------+-------------------+------------+
PK Row Row
+---------+-------------------+------------+
1 C F
+---------+--

http://www.bkjia.com/PHPjc/486482.html www.bkjia.com true http://www.bkjia.com/PHPjc/486482.html techarticle Online collected a lot about the database paradigm understanding of the article, are thousands of copies of a copy and paste, even examples are exactly the same, please be a little creative, really do not look down, their own ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.