当前位置:网站首页>Three paradigms of MySQL

Three paradigms of MySQL

2022-06-13 05:33:00 zrllllll

Last week , Feeling comfortable in life , The project functions are almost written , Suddenly the senior said he would interview us this week java Basics , All of a sudden, I feel refreshed . Yesterday, I had an interview and the results came out , The following is the senior's evaluation of me
 Insert picture description here
I forgot a lot about the database , Although usually used in projects , But I still haven't remembered some basic knowledge .

Three paradigms of database :

The concept of paradigm :

Some specifications to follow when designing a database , At present, there are six paradigms of relational database : First normal form (1NF)、 Second normal form (2NF)、 Third normal form (3NF)、 buss - The COD paradigm (BCNF)、 Fourth normal form (4NF) And the fifth paradigm (5NF, Also called perfect paradigm ).

Meeting the first three paradigms can design a more standardized database .

Some specifications to follow when designing a database , At present, there are six paradigms of relational database : First normal form (1NF)、 Second normal form (2NF)、 Third normal form (3NF)、 buss - The COD paradigm (BCNF)、 Fourth normal form (4NF) And the fifth paradigm (5NF, Also called perfect paradigm ).

One 、 First normal form (1NF): No more columns can be split
 Insert picture description here
Upper figure , There are two sub columns under the major column , Obviously, it does not conform to the first paradigm .

 Insert picture description here
This is in line with the first paradigm .

Two 、 Second normal form (2NF): On the basis of the first paradigm , Non primary key columns are completely dependent on the primary key , Instead of relying on a part of the primary key .

1. Function dependency : If you pass A attribute ( Attribute group ), It's certain that the only B The value of the property , that B Depend on A. For example, the name shown above , Completely dependent on the student id
2. Completely function dependent : If A It's an attribute group , be B The determination of attribute values depends on A All attribute values in the attribute group . Attribute groups refer to multiple fields , So for example, if we want to know a score , You must rely on the two attributes of student number and course name to determine a score , Other attributes cannot determine a certain score
3. Part of the function depends on : If A It's an attribute group , be B The determination of attribute value depends on A Some fields of the attribute group can , For example, the student number and course name are an attribute group , In fact, the student name can be determined only by the student number
4. The transfer function depends on : If A attribute ( Attribute group ), The only one can be determined B The value of the property , Re pass B The value of the attribute can be uniquely determined C The value of the property , For example, a student number determines a department name , A department name corresponds to a dean
5. Primary key : In a table , An attribute or group of attributes , Completely dependent on all other properties , This attribute is called the table of the code , For example, the attribute group composed of student ID and course name in the above figure

1. Function dependency : If you pass A attribute ( Attribute group ), It's certain that the only B The value of the property , that B Depend on A. For example, the name shown above , Completely dependent on the student id
2. Completely function dependent : If A It's an attribute group , be B The determination of attribute values depends on A All attribute values in the attribute group . Attribute groups refer to multiple fields , So for example, if we want to know a score , You must rely on the two attributes of student number and major name to determine a score , Other attributes cannot determine a certain score
3. Part of the function depends on : If A It's an attribute group , be B The determination of attribute value depends on A Some fields of the attribute group can , For example, student ID and major name are an attribute group , In fact, the student name can be determined only by the student number
4. The transfer function depends on : If A attribute ( Attribute group ), The only one can be determined B The value of the property , Re pass B The value of the attribute can be uniquely determined C The value of the property , For example, a student ID determines a major name , A major name corresponds to a major leader .
5. Primary key : In a table , An attribute or group of attributes , Completely dependent on all other properties , This attribute is called the table of the code , For example, the attribute group composed of student ID and major name in the above figure

Simply speaking , The second normal form is to eliminate the partial dependence of non primary keys on primary keys on the basis of the first normal form .
So we can divide the watch into two
 Insert picture description here
 Insert picture description here
3、 ... and 、 Third normal form (3NF): On the basis of the second paradigm , Non primary key columns only depend on the primary key , Not dependent on other non primary keys .

 Insert picture description here

原网站

版权声明
本文为[zrllllll]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280510456206.html