KitCarl Posted September 16, 2010 Share Posted September 16, 2010 I need to track ownership of animals that can have up to four owners at a time which can change as they are bought/sold. I have a person table with all their info and an animal table with their respective info. Is there a better way to store this info than using a table with the fields listed below. What problems do you forward thinkers for see for this down the road? PersonAnimalID | AnimalID | PersonID | DateBought | DateSold Quote Link to comment https://forums.phpfreaks.com/topic/213611-keeping-track-of-changing-multiple-owners-of-an-object/ Share on other sites More sharing options...
DavidAM Posted September 17, 2010 Share Posted September 17, 2010 Strictly speaking, the PersonAnimalID is not required (although, sometimes it is useful to have). You can use a primary key composed of the two fields: PersonID,AnimalID (or AnimalID,PersonID). This would only be a problem if a single person can own more than one share of the animal. Other than that, your table suggestion is correct for the "many-to-many" relationship you described - many people own many animals Quote Link to comment https://forums.phpfreaks.com/topic/213611-keeping-track-of-changing-multiple-owners-of-an-object/#findComment-1111944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.