1. Paradigm foundation1.1 The concept of paradigmThere are some specifications that need to be followed when designing a database. Currently, there are six paradigms for relational databases: first paradigm (1NF), second paradigm (2NF), third paradigm (3NF), Buss-Codd Form (BCNF), fourth paradigm (4NF) and fifth paradigm (5NF, also known as perfect paradigm). Of course, under normal circumstances, we can design a more standardized database if we meet the first three paradigms. To follow the latter paradigm, you must first follow the requirements of the previous paradigm. For example, the second paradigm must first follow the first paradigm, the third paradigm must first follow the second paradigm, and so on. 2. Three major paradigms2.1 Three major paradigm concepts First Normal Form (1NF): Each column cannot be split any further. 2.2 Examples of the three paradigmsFor example, we have a table. In the following examples, we will transform this table into three paradigms and then turn it into a standard table: 1. Transform the first paradigmFirst Normal Form (1NF): Each column cannot be split any more We can see that there is a column in the table that can be divided, that is, the series, so the transformation of it into the first normal form becomes: 2. Transformation of the Second ParadigmSecond Normal Form (2NF): Based on the first normal form, non-primary key columns are completely dependent on the primary key, and cannot be part of the primary key. This second paradigm is not easy to understand, so let's first understand a few concepts: 1. Function dependency: If the value of a unique B attribute can be determined from an A attribute (or attribute group), then B depends on A. For example, the name in the picture above is completely dependent on the student number. In fact, the second paradigm can also be understood as Eliminate partial dependence of non-primary keys on primary keys based on the first paradigm The primary key in the above figure is the attribute group consisting of the student number and the course name. For the above figure, we can see that except for the score, all other attributes are partially dependent on the primary key. Then we can correct it as shown below: After the second normal form transformation, a table is divided into two tables. We find that the second normal form actually eliminates a lot of redundant parts for us. For example, before the transformation, Zhang Wuji's name, department name, and department dean appeared three times in the table, but after the transformation, they only appeared once in the two tables. 3. Transformation to the Third ParadigmThird Normal Form (3NF): Based on the second normal form, non-primary key columns only depend on the primary key and do not depend on other non-primary keys. According to the concept we mentioned in the second point, it becomes: The above is the detailed content of the three major paradigms of MySQL learning for beginners. For more information about the three major paradigms of MySQL, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Summary of knowledge points about events module in Node.js
>>: How to use an image button as a reset form button
After creating a container locally, you can creat...
Table of contents Features Preservation strategy ...
After installing MySQL using ports, I found that ...
Table of contents Slow query basics: optimizing d...
GitHub address: https://github.com/dmhsq/dmhsq-my...
Preface The sleep system function in MySQL has fe...
Frequently asked questions Access denied for user...
This article example shares the specific code of ...
Table of contents Transaction Isolation Level Wha...
background Search the keyword .htaccess cache in ...
During system maintenance, you may need to check ...
MySQL 5.7.21 winx64 free installation version con...
Table of contents 1. What is the execution contex...
When you start working on a project, it’s importa...
Absolute positioning method: (1) Set the parent e...