I am having a problem with foreign keys between two tables. I am trying to model a relationship between members of a club and their relatives. This is a straightforward many-to-one relationship, with many relatives related to one member. However, one and just one of this relatives must be the main contact. Also, many members can have the same relative as main contact (siblings to their father as an example).
EDIT: Members are kids, and relatives must be adults, so relatives can't be members, and members can't be main contact of another member.
A FK on member table refering the PK of relatives would work, but this will leave me with a circular reference and a "chicken-or-egg" problem.
What is the right approach to this kind of problems? Maybe I am just thinking it too much.
Schema is more or less like this:
+--------------+ +-------------+
| member | | relatives |
+--------------+ +-------------+
|id |<-+ |id |<-+
|name | +-|*member_id | |
|address | |name | |
|phone | |relationship | |
|... | |phone | |
|*main_contact |-+ |... | |
+--------------+ | +-------------+ |
+-------------------+
relatives(member_id) REFERENCES member(id)) should be many-to-many, not one-to-many. – ypercubeᵀᴹ May 02 '14 at 00:19