ER模型

作者: Dongle聊测试 | 来源:发表于2019-07-16 22:41 被阅读0次

什么是ER模型?

技术人员和非技术人员容易沟通的东西

  • 实体类型
  • 联系
  • 属性

二话不说直接上图


一个复杂的ER图

🍎 实体类型

学生是个实例,从实例中抽象出来的是实体,如所有学生
实体的特点是可标识(性别不可标识,学生可标识:鲜活的一个人,房子可标识:鲜活的存在):



在ER中的体现


🍎 联系类型

联系是从联系的实例中抽象出来的

如张三学过高数,由于张三是学生,高数是课程,所以学生与课程就有联系:


在ER中的体现:
Relationship name是属性



但是,Staff不一定与Brach只有一个关系,这里可能有很多个关系(要根据实际来操作)---成为n元联系


🍎 属性

学生
学号
姓名
性别
状态

属性域:这个属性可能存在的值

  • 简单属性:由一个部分组成
  • 复杂属性:由多个部分组成
  • 单值属性:性别是个单值属性
  • 多值属性:爱好是个多值属性
  • 事件属性:表示可以从相关属性或一组属性的值导出的值的属性,不一定在同一实体类型中---持续时间可以从同一实体类型的rentStart和rentFinish计算

站在ER级别上,我们再来看以下在关系模型中提到过的东西

  • Candidate Key: The minimal set of attributes that
    uniquely identifies each occurrence of an entity
    type.
  • A candidate key cannot contain a null.
  • 姓名不能为候选键,因为姓名常常重复
  • Primary Key: The candidate key that is selected to
    uniquely identify each occurrence of an entity type.
  • The choice of primary key for an entity is based on
    attribute length, minimal number of attributes required.
  • Composite Key: A candidate key that consists of
    two or more attributes.
  • In some case, the key of an entity type is composed of
    several attributes, whose values together are unique for
    each entity occurrence but not separately.
  • 姓名和性别的组合,可以为组合建

🍎 强和弱实体类型

强实体类型:与其他实体类型不相关的实体类型
弱实体类型:与其他实体类型存在依赖关系的实体类型


🍎 设计要素】

一对一hello

相关文章

网友评论

      本文标题:ER模型

      本文链接:https://www.haomeiwen.com/subject/qyeotxtx.html