[Database.System.Concepts(6th.Edition.2010)].Abraham.Silberschatz. Ch8学习笔记

Database

Ch8.relational design

8.1 features of good design

8.1.1 larger alternatives

why design is good ?

Otherwise ,a larger alternative(schema) may cause:

1)redundancy

2)update may cause inconsistency

3)update may bring nulls

8.1.2 smaller alternatives

Functional dependency : A-->B,   i.e.A determines uniquely B (a kind of function relation , injection) ,lead to repetition in schema.

 

//An e.g. of bad deposition.

So,how do we make a smaller alternative(schema)?

 It is impossible to divide a larger schema into a smaller one by means of finding repetition caused by join(why impossible? large amount of data and unknown of relations int the real world).

 What matters is the the functional dependency(the rules in the real world).

On the other hand,a smaller alternative(schema) may cause:

1) lossy decomposition.which means when you decompose relation X,getting Y&Z.You will find  Y join Z !=X.

 

8.2 atomic domains &1st normal form

atomic if elements of the domain are considered to be indivisible units.

a relation schema R is in first normal form (1NF) if the domains of all attributes of R are atomic.

Discuss in whether cs0114 is an atomic domain.

 

8.3 Decomposition Using Functional Dependencies

Recall notation

1)Roman letter stands for a relation set while Greek letter for other attribute set(always one attribute).

2)K is a super-key of r (R).(candidate key is a minimal super-key )

3)we use single lowercase letter in our definitions and algorithms,not for eg. Instructor.

4)instance of r means a particular value at some given time.

8.3.1 Keys and Functional Dependencies

Define :relations have feature of functions .

 α → β holds on R if and only if for any legal relations r(R), whenever any

two tuples t1 and t2 of r agree on the attributes α, they also agree

on the attributes β. That is,

t1[α] = t2 [α] ⇒ t1[β ] = t2 [β ]

 

We say that the instance satisfies the functional Dependency

We say that the functional dependency   α → β  holds on schema r (R)

 

A functional dependency is trivial if it is satisfied by all instances of a relation

Example:

4 ID, name → ID

4 name → name

l In general, α → β is trivial if β ⊆ α Some times  α !→ β  but alpha,gamma->beta.

(i.e.. In some special instance of instructor,name may ->ID,but it is not true for all instances)

 

notation F+ to denote the closure(satisfy transitive) of the set F,

 

8.3.2 BoyceCodd Normal Form

Boyce–Codd normal form (BCNF) eliminates all redundancy that can be discovered based on functional dependencies.

 

Formal definition

A relation schema R is in BCNF with respect to a set F of

functional dependencies if for all functional dependencies in F+ of

the form

 α → β

where α ⊆ R and β ⊆ R, at least one of the following holds:

1)α → β is trivial (i.e., β ⊆ α)

2)nα is a superkey for R 

In other words,BCNF requires that all nontrivial dependencies be of the form α → β  , where  α is a superkey.

In other words,BCNF requires that all α → β ,where α is not super key , to be trivial.

 

Suppose we have a schema R and a non-trivial dependency α →β

causes a violation of BCNF.

We decompose R into:

• (α U β )

• ( R - ( β - α ) ) 

It’s quite reasonable.

 

 

 

8.3.3 BCNF and Dependency Preservation

About testing constrains.

Constraints, including functional dependencies, are costly to check in practice unless they pertain to only one relation

A decomposition is dependency preserving.If it is sufficient to test only those dependencies on each individual relation of a decomposition in order to ensure that all functional dependencies hold

It is not always possible to achieve both BCNF and dependency preservation(in some cases, decomposition into BCNF can prevent efficient testing of certain functional dependencies.)

, we consider a weaker normal form, known as third normal form.

When a dependency whose attributes do not all appear in any one schema we call it is not dependency preserving.

BCNF is not dependency preserving but  3rdNF is.

second normal(满足第一范式且不存在partial dependency(部分依赖)the 3rd rule of 3rd NF) form is of historical significance only and is not used in practice.

 

8.3.4 Third Normal Form

A relation schema R is in third normal form (3NF) if for all:

α → β in F+

at least one of the following holds:

l α → β is trivial (i.e., β ∈ α)

l α is a superkey for R

l Each attribute A in β – α is contained in a candidate key for R.

 (NOTE: each attribute may be in a different candidate key)

 

BCNF requires that all nontrivial dependencies be of the form α→β , where  α is a superkey.

 

Third normal form (3NF) relaxes this constraint slightly by allowing certain nontrivial functional dependencies whose left side is not a superkey.

 

Third condition is a minimal relaxation of BCNF to ensure dependency preservation (will see why later).

 

Normalization:

In the case that a relation scheme R is not in goodform,

decompose it into a set of relation scheme {R1, R2, ..., Rn} such that

l each relation scheme is in good form

l the decomposition is a lossless-join decomposition

l Preferably, the decomposition should be dependency preserving

 

8.4 8.5 8.6:theorem &&algorithm for decomposition using NF

转载于:https://www.cnblogs.com/SuuT/p/9984414.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
数据库系统概念 第六版》是由Avi Silberschatz、Henry F. Korth和S. Sudarshan合著的一本经典教材。本书系统地介绍了数据库系统的基本概念、原理和技术,涵盖了数据库的设计、实施和管理等方面的知识。 这本书主要分为五个部分。第一部分介绍了数据库系统的综述和结构。它介绍了数据库系统的发展历程、组成部分以及其在信息科技领域的重要性。同时还阐述了数据模型、数据模型之间的转换以及数据存储和查询处理的基本原理。 第二部分主要涉及数据库设计的过程。它详细介绍了关系数据库模型以及用于描述关系模式的语言。此外,还探讨了关系数据库的范式理论和数据库设计的规范化过程。读者能够学习如何将现实世界的信息转化为数据库表结构,并掌握如何优化数据库设计。 第三部分介绍了数据库查询的处理和优化。其中包含了关系代数的基本操作和关系运算的属性。此外,还介绍了查询处理器的原理和优化技术。读者可以学习如何编写高效的查询并理解查询执行的各个环节。 第四部分专注于并发控制和故障恢复。它讨论了并发操作的问题,包括事务和并发控制机制。此外,还介绍了故障恢复的概念和实现原理。读者能够了解如何保证多个用户同时访问数据库的数据一致性,并学习如何恢复发生故障的数据库。 最后一部分介绍了一些高级主题,如分布式数据库、物理数据库设计和安全性。它讨论了分布式数据库的设计原则和架构,并介绍了物理数据库设计的关键问题。此外,还阐述了数据安全性和访问控制的重要性和技术手段。 总的来说,《数据库系统概念 第六版》是一本经典的教材,系统地介绍了数据库系统的基本概念和相关技术。无论是对于初学者还是有经验的数据库专业人士,都是一本值得阅读的书籍。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值