Three paradigms of the database

Source: Internet
Author: User

Three paradigms of the database

The database paradigm is proposed in order to standardize the data in the relational database, the first paradigm, the second paradigm, the third paradigm, the three paradigms gradually subdivide the data, meaning that the relationship between the data of one of the three paradigms is becoming more and more obvious. The following is a detailed explanation of the three paradigms.

First Paradigm (1NF): The columns (attributes) of a table of a database belonging to the first paradigm cannot be further split. Such as

School Number Course
2014212797 High number of Software Technology Foundation

Obviously, the second column of this table can be subdivided, so it is not part of the first paradigm. The first paradigm is the minimum requirement of database data, the "database" that does not satisfy the first paradigm cannot be called a relational database, and the combination item is removed in denormalized data.

School Number Course
2014212797 Fundamentals of Software Technology
2014212798 High number

In the first paradigm, data redundancy, insertion, and deletion anomalies occur. (such as the repetition of the secondary number in the table above)

The second paradigm (2NF): First the conditions of the first paradigm must be met, and the table has to have a primary key, and not a property of the primary key (meaning that the primary key can be several properties) must be completely dependent on the primary key (this sentence a bit around, well understood), When you set the properties of a table, you can retrieve a unique property based on the primary key, and you cannot get a few results. If a partially dependent property appears, separate the attribute from the dependent part of the primary key and create a separate table. The task of the second paradigm is to eliminate the partial function dependency under the condition of satisfying the first paradigm.

School Number |  name |  email | Course Number | Course Address

2323 LF DDD 123 345

2323 LJ DSD 345 3789

Obviously this table belongs to the first paradigm, where the primary key (from the school number and the course address) can be located in a unique row. However, the course address is partly dependent on the course number and is not associated with the study number, so the database is not in the second paradigm. Therefore, it is necessary to tell the partial dependent primary key and the property to create a separate table. The original table becomes a two table:

School Number |  name |  email | Course Number

2323 LF DDD 123

2323 LJ DSD 345

Course Number | Course Address

123 34

345 3789

Databases that do not conform to the second paradigm tend to generate data redundancy

The third paradigm (3NF): First satisfies the second normal form, simultaneously cannot exist the transitive dependence. That cannot exist: non-primary key column A relies on non-primary key column B, and non-primary key column B depends on the primary key.

In short, the third paradigm (3NF) requires that a database table not contain non-primary key information already contained in other tables. For example, there is a departmental information table, where each department has a department number (dept_id), a department name, a department profile, and so on. Then the department number is listed in the Employee Information table, the department name, department profile and other departments related information can no longer be added to the Employee Information table. If there is no departmental information table, it should be built according to the third paradigm (3NF), otherwise there will be a lot of data redundancy. In short, the third paradigm is that properties do not depend on other non-principal properties.
Studyno |   Name |      Sex |      Email |   Bounslevel | Bouns

20040901 John Male [email protected] excellent $1000

20040902 Mary Famale [email protected]

This completely satisfies the second paradigm, but Bounslevel and bouns exist transitive dependencies

Change to:

Studyno |   Name |      Sex |      Email | Bouunsno

20040901 John Male [email protected] 1

20040902 Mary Famale [email protected] 2

Bounsno |   Bounslevel | Bouns

1 Excellent $1000

2 Liang

Table Bounsno as the primary key

A relational database that generally conforms to the third paradigm avoids the data redundancy situation.

This article refers to a few blog posts:

http://blog.csdn.net/sunzhenhua0608/article/details/16850053

http://blog.csdn.net/famousdt/article/details/6921622

Student Management System: http://www.cnblogs.com/nx520zj/archive/2013/05/29/3105725.html

Three paradigms of the 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.