在两个数据库表之间建立多个关系是一个好习惯吗?
我有两个数据库表,ACTIVITY 和 USER。
在ACTIVITY表中,我有3个需要关联的字段AssignedTo、CreatedBy和LastModifiedBy(1对多) ,以便用户可以使用 UserId 字段和 USER 表的主键创建、修改和分配给许多活动。
在两个表之间创建三种不同的关系(所有这三个关系都与父表的主键(在本例中为 UserId)连接)是否是一个好习惯?
I have two DB tables, ACTIVITY and USER.
In the ACTIVITY table I have 3 fields AssignedTo, CreatedBy and LastModifiedBy that need to be related (1 to many, so that a user can create, modify and be assigned to many activities) with UserId field and primary key of the USER table.
Is it a good practice to create three different relationships between the two tables, all three connected with the primary key, in this case UserId, of the parent table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这没有什么问题。只要去做,就是正确的。
在思考时:您可能会看一下记录的版本控制。这是更进一步的一步,但为您提供了有关谁编辑记录以及何时编辑的更多信息。
Yes, nothing wrong with that. Just do it, it is correct.
While thinking about it: You might take a look at versioning of records. That is a step further but gives you even more info about who edited a record and when.