0

我有问题,因为我不确定它是否可能,如果它是我应该使用哪种关系,我的问题看起来像:

桌子Users

Id

桌子Transaction

Id
IdProducentUser
IdConsumerUser

每列都是必需的。

在这种情况下,两者都IdProducentUser应该IdConsumerUserforeign key这样,每个用户都可以有很多事务,但我不知道我应该使用哪种关系以及我应该如何在图表上绘制它。

任何帮助,将不胜感激。

4

1 回答 1

0

If you have exactly two users in Transaction then you can create two relations one-to-many:

enter image description here

But if your user can take part in multiple Transactions and your Transaction can have multiple Users then it will be a many-to-many relation which in second phase of modeling should be drawn by additional extra entity, which breaks many-to-many relation.

于 2012-11-04T10:08:46.967 回答