简体   繁体   English

Access数据库-为什么这是一对一关系?

[英]Access Database - Why is this a One-To-One Relationship?

My understanding was that: a one-to-one relationship is created when both fields involved are primary keys. 我的理解是:当涉及的两个字段都是主键时,就会建立一对一的关系。

In the case encountered below, I (believe I) have a relationship between a Primary Key and a Foreign key and this should be a one-to-many relationship. 在下面遇到的情况下,我(相信我)在主键和外键之间有一个关系,这应该是一对多关系。 But Access is showing it as a one-to-one relationship, and will not allow duplicate entries on the many side. 但是Access将其显示为一对一关系,并且不允许在多方面重复输入。

What is the error in my understanding of this? 我对此的理解有什么错误?

My understanding was that: a one-to-one relationship is created when both fields involved are primary keys. 我的理解是:当涉及的两个字段都是主键时,就会建立一对一的关系。

Then I would suggest your understanding is wrong :-) 那我建议你的理解是错误的 :-)

The target column doesn't have to be a primary key, it's sufficient that it be marked as unique. 目标列不必是主键,将其标记为唯一就足够了。 This would enforce one-to-one at the database level. 这将在数​​据库级别一对一执行。

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

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