Database notes-Relational Model

Source: Internet
Author: User

The relational model only involves the third paradigm. It is some preliminary things, hoping that it will not smile :-)

1NF is the most basic paradigm and there is no need to talk about it. For a relational model that already meets 1NF, 2NF is considered when some function dependencies of non-primary attribute pairs are eliminated; when the part of the primary attribute pair code and the passing dependency function are eliminated, it belongs to 3NF. (Because the soft exam only cares about the third paradigm, so far ).

Simply speaking, the theory is always quite uncomfortable. For example, it will be much better.
The following relationship belongs to 1NF, because all attributes are simple attributes.

Teaching (student ID, name, age, gender, Department name, Department Head, course name, score)-primary code is student ID

However, this relationship has two attributes (Course name and score) that do not depend on its student ID, that is, student ID! → Course name, student ID! → Score, but it should be (student ID, course name) → score. So we break down and make it meet 2NF.

Student _ series (student ID, name, age, gender, Department name, Department Head)-master code is student ID
Electives (student ID, course name, score)-the master code is student ID + Course name

In this mode, all non-primary attributes depend on the primary Code. However, in the "Student _ System", there is a transmission dependency, student ID → department name → department head, and then the transfer dependency is eliminated, and all the relationships will satisfy 3NF. The decomposition is as follows:

Student (student ID, name, age, gender, Department name)-primary code is student ID
Department (Department name, Department Head)-master code is department name
Electives (student ID, course name, score)-the master code is student ID + Course name

Here, three relationships are available, because the third paradigm is basically the lowest one that meets the requirements for use.

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.