The simplest and most easy to remember interpretation of the three paradigms of database

Source: Internet
Author: User

The book said a lot, summed up 3 words:

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

Explain:
1NF: Atomic field can not be divided, otherwise it is not a relational database;
2NF: Uniqueness A table only shows one thing;
3NF: Each column has a direct relationship with the primary key, there is no transmission dependency;

Examples that do not conform to the first paradigm (no such table is created in a relational database):

Table: Field 1, Field 2 (Field 2.1, Field 2.2), Field 3 ...

The problem: Because the design does not have such a table, so there is no problem;

Examples that do not conform to the second paradigm:

Table: School number, name, age, course name, score, credits;

This table clearly illustrates two transactions: Student information, course information;

There is a problem:

Data redundancy, each record contains the same information;
Delete exception: Delete all student scores, all the course information deleted;
Insert exception: Students did not select classes, can not be recorded in the database;
Update Exception: Adjust course credits, all lines are adjusted.

Correction:

Student: Student (school number, name, age);

Course: Course (course name, credits);

Elective relationship: Selectcourse (School number, course name, grade).

Satisfying the 2nd paradigm only eliminates the insertion exception.


Examples that do not conform to the third paradigm:

School number, name, age, Institute, college contact Telephone, the key word for a single key word "school number";

There is a reliance on delivery: (school number) → (college) → (Institute location, college phone)

There is a problem:

Data redundancy: there are duplicate values;

Update Exception: Duplicate redundancy information, modify multiple records at the same time, otherwise there will be inconsistent data

Remove exception

Correction:
Student: (School number, name, age, college);
College: (College, location, telephone).
Author: sunxing007

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.