Normalisation

优秀数据库设计原则
本文探讨了良好的数据库设计标准,包括避免冗余、规范化理论及如何通过分解设计来满足第一、第二、第三及BCNF范式的要求。

What is a good Database design?

Deciding on a suitable robust logical structure for the tables is
a key element of a good relational database design.
A good design has the following features:
Efficient
Avoids possible anomalies.

Normalisation

Normalisation theory is based on some simple ideas and helps guide us in developing a suitable set of tables for a given problem.
Normalisation theory allow us to recognise relations with possibly undesirable properties and design better relations
Function Dependency
Closure of Attributes
If A+ = all attributes, then A is a key.

1NF

A set of relations is in first normal form(1NF) if:
1. Tuples cannot have repeat groups of similar data(atomicity)
2. Each tuple(row of a table) must have a unique identifier(primary key)
generally speaking, we can easily avoid 1NF.

2NF ##

If there is no partial dependency on a concatenated key in any relation.
concatenated key: A key composed of more than one attribute
partial dependency: A functional dependency between an subset of a concatenated key and another set of attributes.

3NF & BCNF

3NF : if there is no dependencies on non-key attributes.
BCDF: if for each non-trivial functional dependency A → B in relation
R, A is a superkey of R.
• A is a superkey of R if A contains a key.
• BCNF is a slightly stronger version then 3NF that handles
relations with two or more overlapping candidate key.

Design by Decomposition
a good relational database design is to move through a series of designs that satisfy 1,2,3NF & BCNF and 4NF

4NF

if for each non-trivial A →→ B, A is a superkey.
Given a set of relations and a set of functional dependencies
FDs and multivalued dependencies MVDs:
• Repeat until all relations are in 4NF
• Select any relation R ′(A, B, C) that violates the 4NF condition.
• Decompose R ′ into R1(A, B) and R2(A, C).
• Compute the FDs and MVDs for R1 and R2.
• Compute keys for R1 and R2.

Disadvantage of BCNF and 4NF
there may be redundant information and anomalies.

To be continued…

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值