你们关系的规则是什么?你需要先定义它。人“拥有”房子?人“住在”房子里?让我们暂时假设它是“拥有”的。然后你有几个选择:
选项 1:无选择性(强制性 1:1):
- Each Person must own exactly one House
- Each House must be owned by exactly one Person
这将表示
1 1
Person ------------- House
选项 2a:可选一种方式:
- Each Person may own at most one House
- A Person need not own any Houses
- Each House must be owned by exactly one Person
这将表示
1 0..1
Person ------------- House
选项 2b:可选的另一种方式:
- Each Person must own exactly one House
- Each House may be owned by at most one Person
- A House need not be owned by any Person
这将表示
0..1 1
Person ------------- House
选项 3:双向可选:
- Each Person may own at most one House
- A Person need not own any Houses
- Each House may be owned by at most one Person
- A House need not be owned by any Person
这将表示
0..1 0..1
Person ------------- House
编辑(*)
您的数据库模式不是上述的。它说:
- Each Person may own at most one House
- A Person need not own any Houses
- Each House may be owned by many People
- A House need not be owned by any Person
不知道这是否是你想要的......?[如果你不明白为什么大喊]。
hth。
*感谢 ypercube 在下面的评论中指出更正。