简体   繁体   English

关系表中应该有数据(多对多)还是应该在单独的表中?

[英]Should there be data in a relationship table(Many-to-Many) or should it be in a separate table?

Should data be separated from a relationship table. 应将数据与关系表分开。

没有数据的关系表

Or should data be within the relationship table? 还是数据应该在关系表中?

与数据的关系表

Small side question: If there will only ever be 1 user per stock . 小问题:如果1 user per stock只会有1 user per stock Should I rather use a composite key as the primary key in the user_stock table? 我是否应该使用composite key作为user_stock表中的primary key

它不应是关系表。用户库存表将用作主表。应该为user_Id和库存ID创建复合键,因为用户_id在交易表中不会唯一

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM