Re: Database Structure Help
Posted by: Rick James
Date: September 22, 2011 04:10PM

> some owners are breeders and some breeders are owners
The "Entities" are
* Person (person_id*, name, etc)
* Breeder (breeder_id*, person_id, specialty, etc)
* Owner (owner_id*, person_id, etc)
(* = PRIMARY KEY, probably AUTO_INCREMENT)

Also
* Horse (horse_id*, owner_id, breed, sire, dam, ...) -- Note: this allows one owner to have many horses.

If you also need a horse to have many owners ("many-to-many relationship"), then:
* Horse (horse_id*, breed, sire, dam, ...) -- no owner_id
* HorseOwner (horse_id, owner_id) -- this would have PRIMARY KEY(horse_id, owner_id) (or vice versa) -- This is a "Relationship" table. (It could have extra fields, such as when_purchased, purchase_price, ...

The Syndicate is another "Entity" table. Again, there would be a 1:many or many:many relationship to Owners.

Your queries would have lots of JOINs. Optionally, you could establish "FOREIGN KEYs". You could hide the complexity in VIEWs.

More on the "ER" (Entity-Relationship) modeling:

http://forums.mysql.com/read.php?125,422961 (Simple Database Design Problem)
http://forums.mysql.com/read.php?10,434331 (Circular reference)
http://forums.mysql.com/read.php?125,401536 (Database efficiency question)
http://forums.mysql.com/read.php?10,379859 (school exercise I am suck on)
http://forums.mysql.com/read.php?10,432104 (Design for complex problem)
http://forums.mysql.com/read.php?125,397603 (Help with schema for camera trap tracker)
http://forums.mysql.com/read.php?125,356594 (Database Build - Game concept / inventory management)
http://forums.mysql.com/read.php?125,356144 (Table Structure)
http://forums.mysql.com/read.php?10,241802 (Having trouble designing...)
http://forums.mysql.com/read.php?10,414454 (Database relationship when one entity is optional)
http://forums.mysql.com/read.php?125,261725 (Node/Edge design decision)

Options: ReplyQuote


Subject
Written By
Posted
September 18, 2011 10:42AM
September 19, 2011 01:24AM
Re: Database Structure Help
September 22, 2011 04:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.