开发者

Core data/Database Entity relationships

If two entities exist and in one sense they have a one to many relationship and in another sense they have a many to one relationship. Do these 2 relationships become a many to many or is it ok开发者_StackOverflow社区 to have 2 relationships? One to many, Many to one?


It's a one-to-many relationship, given your example - depending on which side of the relationship you start from it's one-to-many (GPS location -> photo) or many-to-one (photo -> GPS location) - this doesn't make it a many-to-many, though!

A photo has one-and-only-one GPS location, so your tables would look like this...

PHOTO

ID
GPSLocationID
...

GPSLOCATION

ID
LAT
LONG
...


In ER modelling it is quite normal and permissable for two entity types to have more than one relatiomship between them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜