MySQL Paradigm Simple Summary

Source: Internet
Author: User

1. The most basic paradigm of the first paradigm, the attributes of each column in the data table are single and cannot be divided!
Example: Customer table (name, number, address 、......) Where the "address" column can also be subdivided into countries, provinces, municipalities, districts and so on.

2. The second paradigm ensures that each column in the table is related to the primary key, and that a relationship satisfies the first normal form, and that the primary key is dependent on the other column except the primary key
For example: the order form (order number, product number, order date, Price 、......), "order number" as the primary key, "product number" and primary key column do not have a direct relationship, that is, the "Product number" column does not depend on the primary key column, you should delete the column.

3. The third paradigm satisfies the relationship of the second paradigm, except the primary key columns are not dependent on the primary key column!

For example: Order form (order number, date of purchase, customer number, customer name, ...), first look at the table is not a problem, to meet the second paradigm, each column and the primary key column "order number" related, and then you will find "Customer name" and "customer number" related, "customer number" and "Order Number" is also related Finally pass-through dependency, "Customer name" and "Order Number" is also related. In order to satisfy the third paradigm, the "Customer name" column should be removed and placed in the Customer table.

* * * * principle:* * *

Principle: When the combination of fields and fields repeats, such as the combination of a and C above, the first thing to consider is to split them into 2 tables, whether C is split to table 1, or A to table 1, depending on the situation

The key to understand is that the main purpose of defining this paradigm is to reduce data redundancy, which is essentially the existence of a one-to-many, or many-to-many relationship between fields and fields in a table. To solve this problem, we can easily realize the design of database that satisfies the third paradigm.

* * * Summary * * *

It boils down to 3 words:

1NF: field is not divided;
2NF: Primary key, non-primary key field depends on primary key;
3NF: Non-primary key fields cannot depend on each other;

Explain:
1NF: Atomic field can not be re-divided, otherwise it is not a relational database;
2NF: Uniqueness A table shows only one thing;
3NF: Each column is directly related to the primary key, there is no transitive dependency;

MySQL Paradigm Simple Summary

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.