Skip to content

Lecture 8

:material-circle-edit-outline: 约 339 个字 :material-clock-time-two-outline: 预计阅读时间 1 分钟

How good is BCNF?

image-20240416093734016

上面三个attribute加一起才能确定一个tuple,才是一个key。这表明这个关系里的函数依赖都是泛式的,即这是一个BCNF

但是明显这样有信息冗余,而且如果一个老师没有孩子,根本插不进去;修改信息也很困难。这些都说明这种情况下BCNF不是最规范的

直观上还是得拆成两个表

image-20240416094129912

再规范的就是第四范式

Multivalued Dependencies (MVDs)

多值依赖

就是上面一个ID决定了多个child_name ,一个ID决定了多个phone_number

  • ID →→ child_name
  • ID →→ phone_number

Theory of MVDs

函数依赖是多值依赖的特殊形式

If A→B, then A→→B

Fourth Normal Form

除了左边是key的多值依赖,只存在频繁的多值依赖,就是四范式

If a relation is in 4NF it is in BCNF

image-20240416104115365

例子

image-20240416110729056

image-20240416110739766

Overall Database Design Process

规则:先画出ER图,再按规则转化为关系模式即可

当然也有人先列出实体,然后再连在一起,这就需要规范化了

  • R could have been generated when converting E-R diagram to a set of tables
  • R could have been a single relation containing all attributes that are of interest (called universal relation).
    • Normalization breaks R into smaller relations
  • R could have been the result of some ad hoc design of relations, which we then test/convert to normal form

image-20240416105332174

Chapter 8: Complex Data Types

Object-based Databases

????