Easy understanding of three database paradigms

Source: Internet
Author: User
Easy to understand the official definition of the three paradigm of the database: the first paradigm (1NF): fields in the database table are single attributes and cannot be divided. My understanding: the first paradigm does not need to be mentioned. as long as relational databases meet the official definition of the first paradigm: the second paradigm (2NF ): the database table does not have some function dependencies between non-keyword fields and any candidate keyword fields.

Easy to understand the official definition of the three paradigm of the database: the first paradigm (1NF): fields in the database table are single attributes and cannot be divided. My understanding: the first paradigm does not need to be mentioned. as long as relational databases meet the official definition of the first paradigm: the second paradigm (2NF ): the database table does not have some function dependencies between non-keyword fields and any candidate keyword fields.

Easy understanding of three database paradigms

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

+ --------- + ----------------- + ------------ +

2 C G

+ --------- + ----------------- + ------------ +

3 C K

+ --------- + ----------------- + ------------ +

Principle: when the combination of fields and fields is repeated and the combination of A and C is repeated, you must first consider splitting them into two tables, whether C is split to Table 1 or A is split to Table 1 depends on the situation.

The key is to understand that the main purpose of defining this paradigm standard is to reduce data redundancy. the essence of data redundancy is that there is one-to-many or many-to-many relationship between fields in a table. The database design meeting the third paradigm can be easily implemented by solving the relationship between several pairs.

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.