Three Paradigms of database

Source: Internet
Author: User

Three Paradigms of database

2015-05-19

13 informal description of the paradigm
23 Paradigm Interpretation
33 Paradigm Examples

13 informal description of the paradigm

Return

    • 1NF: field is not divided;
    • 2NF: There is a primary key, the non-primary key field is completely dependent on the primary key, so-called full dependency refers to the existence of only the main key to rely on a part of the property (mainly for the Federated primary Key);
    • 3NF: Non-primary key fields cannot depend on each other;
23 Paradigm Interpretation

Return

    • 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;
33 Paradigm Examples

Return

3.1 First Paradigm

Table 1 Examples that do not conform to the first paradigm (create a table in a relational database)

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;

3.2 Second Paradigm

Table 2 Examples that do not conform to the second paradigm:

School Number Name Age Course Name Results Credits

Because the students have many courses, the school number and the course name as the joint primary key of the table. The name and age of the table depend only on the attribute number of the primary key, and the grades and credits depend only on the attribute course name of the primary key, which does not conform to the second paradigm.

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:

Table 2.1 Students

School Number Name Age

Table 2.2 Courses

Course Name Credits

Table 2.3 Course Selection Relationship

School Number Course Name Results

Satisfying the 2nd paradigm only eliminates the insertion exception.

3.3 Third Paradigm

Table 3 examples that do not conform to the third paradigm:

School Number Name Age School of your own College Contact number

Keyword is 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: The students graduated from the field, will also delete the school information

Correction:

Table 3.1 Students

School Number Name Age School of your own

Table 3.2 College

School of your own College Contact number

Three Paradigms of database

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.