Database E/R diagram problem

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

  1. purebad

    purebad I don't need your approval, right?

    Joined:
    Aug 25, 2006
    Messages:
    4,376
    Likes Received:
    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. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    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. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    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 :o Who the fuck knows who the father/mother is in that situation :mamoru:
     
  4. Coottie

    Coottie BOOMER......SOONER OT Supporter

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

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    i think you misunderstood.... sudo code:

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

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,924
    Likes Received:
    11
    Location:
    Los Angeles
    I remember this shit in school. :o
     
  7. Coottie

    Coottie BOOMER......SOONER OT Supporter

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

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    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.
     
  9. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    WTF?? Yeah it's a real word. I dunno who would call you out on that except someone that hasn't had much math. I've been hearing about it since my second or third semester...Discrete Math. For future reference:

    Math.Com

    Wiki
     

Share This Page