some_id
some_id

Reputation: 29886

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 to have 2 relationships? One to many, Many to one?

Upvotes: 0

Views: 109

Answers (2)

nvogel
nvogel

Reputation: 25534

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

Upvotes: 1

Will A
Will A

Reputation: 25008

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
...

Upvotes: 1

Related Questions