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

Summary of database paradigm

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1NF: each column of a database table is an indivisible basic data item.

Analysis: there are no multiple columns that represent the same property; the value of a column cannot be a collection. It is almost impossible to represent an one-to-many relationship as multiple attributes of a table or multiple values of an attribute.

Solution: create a new table with "1" as the foreign key of the new table.

For example:

Person

Id

Name

Hobby1

Hobby1

Bobby3

one

Mark

Playing football

Running

Swimming

Or

Person

Id

Name

Hobbies

one

Mark

Playing football,running,awimming

2NF: conforms to 1NF; there is a primary key and there are no partial functional dependencies (there are no columns that depend on part of the primary key)

Analysis: in the case of combined keys, some columns depend on only part of the combined primary key, then it does not conform to 2NF.

Solution: move the columns that involve some functional dependencies out of the old table and save them in the new table. Or use artificial primary keys instead of key combinations.

For example:

Employee

Department

Name

ManagerOfDepartment

Development department

Mark

Jenny

3NF: conforms to 2NF; and there is no transitive dependency.

Analysis: column An in the same table depends on column B, and column B depends on column C.

Solution: move the columns involving transfer function dependencies out of the old table and save them in the new table.

For example:

Customer

Name

Phone

Address

ZipCode

Mark

1273283

Guangzhou × × ×

510000

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