Friday, September 16, 2016

Speaking ERDish and Drawing Relationships

  • The language or statements used to describe relationships between entities in an entity-relationship diagram. -ERDish

1.      The goal of this practice is to read a relationship. Which text corresponds to the diagram?

a. Each EMPLOYEE may be assigned to one or more DEPARTMENTs.
Each DEPARTMENT must be responsible for one or more EMPLOYEEs.
b. Each EMPLOYEE must be assigned to one and only one DEPARTMENT.
Each DEPARTMENT must be responsible for one or more EMPLOYEEs.
c. Each EMPLOYEE must be assigned to exactly one DEPARTMENT.
Each DEPARTMENT may be responsible for exactly one EMPLOYEE.
1.      In the diagram for #1 identify the symbols for cardinality.
·         Crow foot on Employee side
·         Single toe on Department side
2.      In the diagram for #1 identify the symbols for optionality.
·         Solid line on Employee side
·         Solid line on department side
3.      Read the relationship in the diagram below. Write the ERD statement for the relationship.



·         Each CAMERA may be (optionality, dotted line) used to take one or more (cardinality, crow’s foot) PHOTOGRAPH
·         Each PHOTOGRAPH must be (optionality, solid line) taken with one and only one ( cardinality, single toe) CAMERA.
1.      Read each relationship in the model below. For each relationship, write the ERD statement and your comments. Use your knowledge of normal people and towns in your comments.




1)      Born in birth place: This is wrong, it says:
·         Each PERSON must be (optionality, solid line) born in one or more (cardinality, crow’s foot) TOWN
·         Each TOWN   may be (optionality, dotted line)   birthplace of one and only one ( cardinality, single toe) PERSON.
Right is: (assuming world has no villages, only towns)



If I assume, there are also villages in this world, solid line near PERSON becomes dotted.
1)      Living in/hometown of:  If I assume, there is no village, only towns in this world, this is OK. It says:
·         Each PERSON must be (optionality, solid line) living in one and only one ( cardinality, single toe) TOWN
·         Each TOWN   may be (optionality, dotted line)   hometown of one or more (cardinality, crow’s foot) PERSON.
If I assume, there are also villages in this world, solid line near PERSON becomes dotted. Also, this assumes that a person will not have two houses, if a person has two houses in two cities, that is not covered here.
2)      Visitor of/visited by: It says:
·         Each PERSON may be (optionality, dotted line) visitor of one or more (cardinality, crow’s foot)  TOWN
·         Each TOWN   must be (optionality, solid line) visited by one or more (cardinality, crow’s foot) PERSON.
I consider it right, because, if a there is a town in this world which is not visited by a PERSON, I won’t dare it call a town.

3)      Mayor of/governed by: it says:
·         Each PERSON may be (optionality, dotted line) mayor of one and only one ( cardinality, single toe)   TOWN
·         Each TOWN   may be (optionality, dotted line) governed by one and only one (cardinality, single toe) PERSON.
Mayor is the elected head of a city, town, or other municipality. And there is no point in selecting two Mayors for same town. Also, I don’t think a mayor can handle two towns. So single toe’s are OK
But I never heard of a city without mayor, even back in India, it exist but designation Title is different. So, solid line on town side seems more logical.


No comments:

Post a Comment