Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An Overview of the three paradigms of mysql

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces an overview of the three paradigms of mysql, which involves things, learned from theoretical knowledge, there are many books, literature for your reference, from the perspective of practical significance, accumulated years of practical experience can be shared with you.

1. The most basic normal form of the first paradigm, the attributes of each column in the data table are single and can no longer be divided!

For example: customer list (name, number, address, etc.) The "address" column can also be subdivided into countries, provinces, municipalities, districts and so on.

two。 The second normal form ensures that each column in the table is related to the primary key, a relationship satisfies the first normal form, and all columns except the primary key depend on the primary key.

For example: order form (order number, product number, order date, price, etc.) The order number is the primary key, and there is no direct relationship between the product number and the primary key column, that is, the product number column does not depend on the primary key column and should be deleted

3. The third normal form satisfies the second normal form relationship, and all the columns except the primary key do not depend on the primary key column!

For example: order form (order number, order date, customer number, customer name, etc.) At first glance, there is no problem with the table, it satisfies the second paradigm, and each column is related to the primary key column "order number". If you take a closer look, you will find that "customer name" is related to "customer number", and "customer number" is related to "order number". Finally, after passing the dependency, "customer name" is also related to "order number". In order to meet the third paradigm, the "customer name" column should be removed and placed in the customer table.

* principle: *

Principle: when there is a repetition of the combination of fields and fields, such as the combination of An and C above, the first thing to consider is to split them into two tables, specifically C to Table 1, or A to Table 1, depending 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 an one-to-many or many-to-many relationship between fields in a table. By solving this several-to-several relationship problem, the database design that meets the third normal form can be easily realized.

* Summary * *

It boils down to three sentences:

1NF: fields cannot be divided

2NF: there is a primary key, and non-primary key fields depend on the primary key

3NF: non-primary key fields cannot depend on each other

Explanation:

1NF: atomic fields can no longer be divided, otherwise they are not relational databases

2NF: uniqueness A table shows only one thing

3NF: each column is directly related to the primary key, and there is no transitive dependency

After reading the above overview of the three mysql paradigms, I hope it can bring some help to everyone in practical application. Due to the limited space in this article, there will inevitably be deficiencies and areas that need to be supplemented. You can continue to pay attention to the industry information section and will update your industry news and knowledge regularly. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report