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 “good” form,

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

[Database.System.Concepts(6th.Edition.2010)].Abraham.Silberschatz. Ch8学习笔记的更多相关文章

  1. #翻译#原文来自Database.System.Concepts(6th.Edition.2010)2.6Relational Operations,原文作者Abraham Silberschaz , Henry F. Korth , S. Sudarshan

    2.6关系操作 所有的过程关系查询语言都提供一组操作,这些操作可以应用于单个关系或一对关系.这些操作具有良好的和期望的属性,它们的结果总是一个单一的关系.这个属性允许一个以模块化的方式组合其中的几个操 ...

  2. [转载]ECMA-262 6th Edition / Draft August 24, 2014 Draft ECMAScript Language Specification

    http://people.mozilla.org/~jorendorff/es6-draft.html#sec-23.4 Draft Report Errors and Issues at: htt ...

  3. 配置recovery_min_apply_delay后重启standby节点报错:psql: FATAL: the database system is starting up

    环境: pg版本:PostgreSQL 9.4.4 on x86_64 系统版本:CentOS release 6.6 linux内核版本:2.6.32-504.8.1.el6.x86_64 今天测试 ...

  4. Principle and Application of Database System

    <数据库系统原理与应用>课程教学大纲 英文名称:Principle and Application of Database System 课程类型:专业必修课 学时/学分:48+16/3. ...

  5. 备库搭建后,进入备库报错psql: FATAL: the database system is starting up

        备库搭建后,进入备库报错psql: FATAL:  the database system is starting up  原因:备库配置文件没有hot_standby = on   mast ...

  6. Anatomy of a Database System学习笔记 - 概论、并发控制

    <Anatomy of a Database System>这篇发表于87年.一共48页的论文据说是DBA入门必看,但是找了全网没有找到中文翻译.这篇文章对关系型数据库确实有提纲挈领的作用 ...

  7. VSTO 学习笔记(十)Office 2010 Ribbon开发

    原文:VSTO 学习笔记(十)Office 2010 Ribbon开发 微软的Office系列办公套件从Office 2007开始首次引入了Ribbon导航菜单模式,其将一系列相关的功能集成在一个个R ...

  8. VSTO学习笔记(八)向 Word 2010 中写入表结构

    原文:VSTO学习笔记(八)向 Word 2010 中写入表结构 前几天公司在做CMMI 3级认证,需要提交一系列的Word文档,其中有一种文档要求添加公司几个系统的数据库中的表结构.我临时接到了这项 ...

  9. 【VS开发】VSTO 学习笔记(十)Office 2010 Ribbon开发

    微软的Office系列办公套件从Office 2007开始首次引入了Ribbon导航菜单模式,其将一系列相关的功能集成在一个个Ribbon中,便于集中管理.操作.这种Ribbon是高度可定制的,用户可 ...

随机推荐

  1. VNC Viewer 设置屏幕分辨率

    1.第一种方法:使用geometry参数进行调整 vncserver -geometry 1280x1024即可,之后通过window下vnc连接后的ubuntu分辨率即为1280x1024了,注意这 ...

  2. 10个最好的免费PS图象处理软件方案

    说到照片和图像编辑/操纵,真的没有更好的应用,Adobe PS图象处理软件. 摄影师和创意工作室会同意这是总理的照片编辑应用期. 不幸的是,PS图象处理软件还配备了一个陡峭的学习曲线和价格标签,我们必 ...

  3. 【Java】设计模型-五种单例模型

    一. 什么是单例模式 只需要某个类同时保留一个对象,不希望有更多对象,此时,我们则应考虑单例模式的设计. 单例模式的主要作用是保证在Java程序中,某个类只有一个实例存在. 单例模式有很多好处,它能够 ...

  4. 常用MQ及其原理

    mq为了解决什么问题?1.异步通信   有些业务不想也不需要立即处理消息.消息队列提供了异步处理机制,允许用户把一个消息放入队列,但并不立即处理它.想向队列中放入多少消息就放多少,然后在需要的时候再去 ...

  5. Paxos 实现日志复制同步(Basic Paxos)

    Paxos 实现日志复制同步 本篇文章以 John Ousterhout(斯坦福大学教授) 和 Diego Ongaro(斯坦福大学获得博士学位,Raft算法发明人) 在 Youtube 上的讲解视频 ...

  6. vscode打造最佳的markdown编辑器

    参考:https://www.jianshu.com/p/18876655b452 在macos下也设置成功:

  7. IntelliJ IDEA(2018)安装和破解

    IDEA 全称 IntelliJ IDEA,是Java语言开发的集成环境,IntelliJ在业界被公认为最好的java开发工具之一,尤其在智能代码助手.代码自动提示.重构.J2EE支持.各类版本工具( ...

  8. 火车头采集器如何采集QQ群成员中的QQ号

    如何采集QQ群群员QQ号,采集QQ号,批量采集QQ号 众所周知,QQ群群员QQ号无法导出,即使会员也不可以,那我们只能通过三方工具来实现我们的要求,那今天我们讲讲如何通过火车采集器来采集QQ群群员QQ ...

  9. Java代码实现文件添加数字签名、验证数字签名

    Linux下实现加签.验签 1.使用OpenSSL 生成公钥和密钥: #用 OpenSSL, Linux 上自带,常用命令如下: #生成 RSA 私钥(传统格式的) openssl genrsa -o ...

  10. 一个tomcat服务器上部署多个Web项目,不同域名访问

    [参考]一个tomcat服务器上部署多个项目,不同域名访问 我们一个服务器只按装了一个tomcat服务器,现在有多个项目或者多个域名访问,下面来进行配置 在这里我们只需要修改conf下的server. ...