# Database E/R diagram problem

Discussion in 'OT Technology' started by purebad, Sep 1, 2006.

Joined:
Aug 25, 2006
Messages:
4,376
0
Location:
Smyrna, GA
Alright, the exercise:

Suppose we wish to keep a genealogy. We shall have one entity set, people. The info we wish to record about persons includes their name (an attribute) and the following relationships: mother, father, and children. Give an E/R diagram involving the people entity set and all the relationships in which it is involved. Include relationships for mother, father, and children; Do not forget to indicate roles when an entity set is used for more than one relationship.

So what I drew seems too simple:

An entity box called people, which has connected the attribute of name.

Then the "motherof" relationship which loops back into the people entity.

Then the "fatherof" relationship which loops back into the people entity.

Then the "childof" relationship which loops back into the people entity, on the loopback I used the notation of a double line with the number 2, specifying that a child is related to 2 persons(aka parents).

For some reason it doesn't seem right though, and thoughts?

2. ### CoottieBOOMER......SOONEROT Supporter

Joined:
Jun 6, 2006
Messages:
32,407
0
Location:
OKC
Double lines indicate total participation.

To indicate multiple instances of a relationship you should indicate a cardinality for each side of the relationship.

3. ### SLEDcustom title

Joined:
Sep 20, 2001
Messages:
28,122
8
Shit, I'd make it easier than that... You only really need a Parent field... and sex I guess. So..

People
Name
Sex
Parent

From this you can tell by sex (and if there are any children under them), if the person is a mother or father. I guess it would only fail if the parents were a gay couple Who the fuck knows who the father/mother is in that situation

4. ### CoottieBOOMER......SOONEROT Supporter

Joined:
Jun 6, 2006
Messages:
32,407
0
Location:
OKC
Huh?? How does sex incicate if they have childeren??? Is that a Yes/No field??

5. ### SLEDcustom title

Joined:
Sep 20, 2001
Messages:
28,122
8
i think you misunderstood.... sudo code:

Code:
```if( sex == "Female" && numChildren > 0 )
MOTHER
if( sex == "male" && numChildren > 0 )
FATHER
```

Joined:
Sep 2, 2003
Messages:
55,997
35
Location:
Los Angeles
I remember this shit in school.

7. ### CoottieBOOMER......SOONEROT Supporter

Joined:
Jun 6, 2006
Messages:
32,407
0
Location:
OKC
yeah I figured it was something like that....previous post was more of a joke.

8. ### deusexaetheraOT Supporter

Joined:
Jan 27, 2005
Messages:
19,712
0
So cardinality IS a word! I knew it! I wrote a function a long time ago to tell me what the cardinality of a number was, so I could use it in a logic block (If...Then...Else...End If) and I got called out on the function name, and when I looked up the word I couldn't find it. Good to know I was right all along.

Joined:
Jun 6, 2006
Messages:
32,407