简体   繁体   English

ER图不断显示一对多关系

[英]ER Diagram keeps showing One-to-many relationship

I just generated a ER Diagram from MySQL workbench using table I'd created before and I encounter some problems. 我刚刚使用以前创建的表从MySQL工作台生成了一个ER图,遇到了一些问题。

图

My problem is, the ER Diagram shows only one-to-many relationships. 我的问题是,ER图仅显示一对多关系。 One of those relationship is between bokar table and bokar_detail table using field nomorbokar on each table, which I've marked before (take a look at red spheres). 这些关系之一是在每个表上使用字段nomorbokar进行的bokar表和bokar_detail表之间的关系,我之前已对其进行了标记(请看一下红色球体)。

In fact, the relationship between those two tables is supposed to be one-to-one relationship, because each table can only contain one nomorbokar record, no duplication. 实际上,这两个表之间的关系应该是一对一的关系,因为每个表只能包含一个nomorbokar记录,不能重复。

I got that rule by setting nomorbokar field in bokar_detail table as a foreign key, referencing on nomorbokar field in bokar table. 我设置了该规则nomorbokar现场bokar_detail作为一个外键表上引用nomorbokar现场bokar表。

I set the referenced field as unique key (to prevent duplication) and then set the foreign key as primary key (to prevent duplication) which will obviously generate one-to-one relationship. 我将引用字段设置为唯一键(以防止重复),然后将外键设置为主键(以防止重复),这显然会产生一对一的关系。

What's wrong with my ER diagram? 我的ER图出了什么问题?

Remove relationship between Users & Boker_Detail as that is not required. 删除用户和Boker_Detail之间的关系,因为这不是必需的。 Others are OK. 其他的还可以。

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

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