Database three paradigm, easy to understand _ PHP Tutorial

Source: Internet
Author: User
Database three paradigm, easy to understand. I have collected a lot of articles on understanding the database paradigm on the Internet, all of which are copied and pasted. even the examples are the same. please be creative. I can't see them anymore, I have collected a lot of articles on understanding the database paradigm on the Internet, all of which are copied and pasted. even the examples are the same. please be creative. I can't see them anymore, write an article on understanding the three paradigms by yourself. If your understanding is incorrect, contact me: 279537592 # qq.com (#=> @)

Official definition: 1NF: Fields in database tables are single attributes and cannot be classified.
My understanding: the first paradigm does not need to be mentioned. as long as relational databases meet the first paradigm

Official definition: second paradigm (2NF): Some function dependencies of non-keyword fields on any candidate keyword fields in database tables
In my understanding: in the second paradigm, the combination of A or B in the primary key (AB) [Note: also called A composite primary key] cannot overlap with other fields. to solve this problem, generally, we do not need to combine primary keys and add an ID. as a single primary key, the second paradigm can be satisfied. If you do not want to add an ID, either A or B in the combination primary key (AB) cannot be duplicated with other fields.
For example, if the second paradigm is not met, the combination of A and field C in the composite primary key is repeated.
+ ------------ + ----------- + ------------------- +
Pk row
+ ------------ + ----------- + ------------------- +
A B C
+ ------------ + ----------- + ------------------- +
A D C
+ ------------ + ----------- + ------------------- +
A E C
+ ------------ + ----------- + ------------------- +

This satisfies the second paradigm (but does not meet the third paradigm, and the combination of field A and field C is repeated ):
+ --------- + ------------ + ----------- + ------------------- +
Pk row
+ --------- + ------------ + ----------- + ------------------- +
1 A B C
+ --------- + ------------ + ----------- + ------------------- +
2 A D C
+ --------- + ------------ + ----------- + ------------------- +
3 A E C
+ --------- + ------------ + ----------- + ------------------- +

Official definition: third paradigm (3NF): Based on the second paradigm, if the data table does not have a transfer function dependency for any candidate keyword segment without a non-keyword segment, it complies with the third paradigm.
My understanding: in the third paradigm, fields and fields cannot be combined repeatedly.
For example, if the third paradigm is not met, the combination of field A and field C is repeated.
+ --------- + ------------ + ----------- + ------------------- + --------------- +
Pk row
+ --------- + ------------ + ----------- + ------------------- + --------------- +
1 A B C F
+ --------- + ------------ + ----------- + ------------------- + --------------- +
2 A D C G
+ --------- + ------------ + ----------- + ------------------- + --------------- +
3 A E C K
+ --------- + ------------ + ----------- + ------------------- + --------------- +

To meet the third paradigm:
Table 1
+ --------- + ------------ + ----------- +
Pk row
+ --------- + ------------ + ----------- +
1 A B
+ --------- + ------------ + ----------- +
2 A D
+ --------- + ------------ + ----------- +
3 A E
+ --------- + ------------ + ----------- +
And Table 2
+ --------- + ----------------- + ------------ +
Pk row
+ --------- + ----------------- + ------------ +
1 C F
+ --------- + --

...

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.