Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between the first, second and third paradigm of database paradigm

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the difference between the first, second and third paradigm of database paradigm". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. let's study and learn "what's the difference between the first, second and third paradigm of database paradigm?"

The differences between the first, second and third paradigm of the database paradigm are: 1, the first normal form is the column without repetition; 2, the second normal form is that the attribute is completely dependent on the primary key; 3, the third normal form is that the attribute does not depend on other non-primary attributes.

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

First normal form (1NF) columns without repetition

The so-called first normal form (1NF) means that each column of a database table is an inseparable basic data item, and there can not be multiple values in the same column, that is, an attribute in an entity cannot have multiple values or duplicate attributes. If there are duplicate attributes, you may need to define a new entity, the new entity consists of duplicate attributes, and there is an one-to-many relationship between the new entity and the original entity. In the first normal form (1NF), each row of the table contains only one instance of information. In short, the first paradigm is a column without repetition.

1NF is defined as: every attribute in a 1NF-compliant relationship can no longer be separated.

The 1NF requirements are not met as shown in the following table:

Note: in any relational database, the first normal form (1NF) is the basic requirement of the relational schema, and the database that does not meet the first normal form (1NF) is not a relational database.

The second normal form (2NF) attribute depends entirely on the primary key

The second normal form (2NF) is established on the basis of the first normal form (1NF), that is, to meet the second normal form (2NF) must first meet the first normal form (1NF). The second normal form (2NF) requires that each instance or row in a database table must be uniquely localized. To achieve differentiation, you usually need to add a column to the table to store the unique identity of each instance. For example, an employee number (emp_id) column is added to the employee information table, because each employee's employee number is unique, so each employee can be uniquely distinguished. This unique attribute column is called the primary keyword or primary key, primary code.

The second normal form (2NF) requires that the attributes of the entity are completely dependent on the primary keyword. The so-called complete dependence means that there can not be an attribute that depends only on part of the primary keyword. If it exists, then this part of the attribute and the primary keyword should be separated to form a new entity. There is an one-to-many relationship between the new entity and the original entity. To achieve differentiation, you usually need to add a column to the table to store the unique identity of each instance. In short, the second paradigm is that properties are completely dependent on the primary key.

The third normal form (3NF)

To meet the third normal form (3NF), we must first meet the second normal form (2NF). In short, the third normal form (3NF) requires that a database table does not contain non-primary keyword information that has already been contained in other tables.

For example, there is a department information table in which each department has a department number (dept_id), department name, department profile, and so on. Then after listing the department number in the employee information table, the department name, department profile and other department-related information can no longer be added to the employee information table. If there is no department information table, it should also be built according to the third normal form (3NF), otherwise there will be a lot of data redundancy.

In short, the third paradigm is that attributes do not depend on other non-primary attributes. In other words, if there is a transfer function dependency of non-primary attributes on the code, it does not meet the requirements of 3NF.

Example explanation: the first paradigm

If all attributes of a relational schema R are inseparable basic data items, then R ∈ 1NF (that is, R conforms to the first normal form).

Two points:

Only a single value can be stored in each field

Each record should be able to use a unique primary key to identify it.

The second paradigm

If the relational pattern R ∈ 1NF (that is, R conforms to the first normal form), and every non-principal attribute is completely dependent on the code of R, then R ∈ 2NF (that is, R conforms to the second normal form).

The third paradigm

If the relational pattern R ∈ 3NF (that is, R conforms to the third normal form), then each non-primary attribute is neither partially dependent on the code nor transitively dependent on the code.

Thank you for your reading. The above is the content of "what is the difference between the first, second and third paradigm of the database paradigm?" after the study of this article, I believe you have a deeper understanding of the difference between the first, second and third paradigm of the database paradigm, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report