例1

image.png

E-R图
image.png

- 箭头法标识实体在联系中可联系的另一个实体个数
- 数字法标识实体在联系中可参与的次数

一种材料只能由一家提供,一家可提供多种材料,因此:
- 箭头如图
- 数字:Material 1..1 Supplier 0 ..
| | 关系模式: 实体集** 联系集 弱实体集 外码参照 | | Project (ID, name, money, class, start_time, end_time)
Employee (ID, name, gender, title, birthday)
Takes (Employee_ID, Project_ID)**[Employee_ID, Project_ID分别参照Employee, Project]
Manager (**ID**, name, gender, title, birthday)
Manages (**Manager_ID, Project_ID) **[Manager_ID, Project_ID分别参照Manager, Project]
Material (**ID**, name, kind, price)
uses (**Project_ID, Material_ID) [**Project_ID, Material_ID分别参照Employee, Project]
Supplier (**Material_ID, name, phone, city**)*

根据 弱实体集 :
supplier没有足够的属性表示唯一的供应商实体,即使每个supplier都唯一,不同material实体也会有相同的供应商实体,此时将supplies视为特使的联系集,只提供唯一标识Supplier实体的Material_ID,即弱实体集 |


例2

image.png

E-R图
image.png
关系模式: 实体集** 联系集 弱实体集 外码参照**
brand (**id**, name,

country)
model (id, name, price)
option (id, name, price)
car (VIN, price)
dealer (id, name)
customer (id, name)
belong (brand_id, model_id) **[外码brand_id, model_id参照brand, model]
manufactured (VIN, **model_id, option_id, time) [外码model_id, option_id参照model, option]
sell (dealer_id, VIN, time) **[外码dealer_id参照dealer]
purchase (**customer_id, VIN, time) [外码customer_id参照customer]** |