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
+ --------- + --
...