Database of three-type popular analysis (reproduced)

Source: Internet
Author: User

The book said a lot, 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;

Explanation:
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;

Examples that do not conform to the first paradigm (create a table 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, grade, credit;

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

A problem exists:

Data redundancy, each record contains the same information;
Delete exception: Delete all student scores, the course information is completely deleted;
Insert exception: The student does not choose the class, cannot record into the database;
Update Exception: Adjust course credits and all lines are adjusted.

Correction:

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

Course: Course (course name, credits);

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

Satisfying the 2nd paradigm only eliminates the insertion exception.


Examples that do not conform to the third paradigm:

School number, name, age, school, college contact number, key word for a single keyword "study number";

Presence Dependent Delivery: (school number) → (school) → (college location, college phone)

A problem exists:

Data redundancy: there are duplicate values;

Update exception: Duplicate redundant information, modify the need to modify multiple records at the same time, otherwise there will be inconsistent data situation

Delete exception

Correction:
Student: (School number, name, age, school);
College: (College, location, telephone)

Database of three-type popular analysis (reproduced)

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.