Om Ashok Dhinoja
002832284
Assignment - 2
2-29. Draw an E-R diagram for the following situation: ShinyShoesForAll (SSFA) is a small shoe repair shop
located in a suburban town in the Boston area. SSFA repairs shoes, bags, wallets, luggage, and other similar
items. Its customers are individuals and small businesses. The store wants to track the categories to which a
customer belongs. SSFA also needs each customer's name and phone number. A job at SSFA is initiated when a
customer brings an item or a set of items to be repaired to the shop. At that time, an SSFA employee evaluates
the condition of the items to be repaired and gives a separate estimate of the repair cost for each item. The
employee also estimates the completion date for the entire job. Each of the items to be repaired will be
classified into one of many item types (such as shoes, luggage, etc.}; it should be possible and easy to create
new item types even before any item is assigned to a type and to remember previous item types when no item in
the database is currently of that type. At the time when a repair job is completed, the system should allow the
completion date to be recorded as well as the date when the order is picked up. If a customer has comments
regarding the job, it should be possible to capture them in the system.
2-34. The Is Married To relationship in Figure 2-12a would seem to have an obvious answer in Problem and
Exercise 2-33d-that is, until time plays a role in modeling data. Draw a data model for the PERSON entity type
and the Is Married To relationship for each of the following varia tions by showing the appropriate cardinalities
and including, if necessary, any attributes:
a. All we need to know is who a person is currently married to, if anyone. (This is likely what you
represented in your answer to Problem and Exercise 2-33d.}
b. We need to know who a person has ever been married to, if anyone.
c. We need to know who a person has ever been married to, if anyone, as well as the date of their marriage
and the date, if any, of the dissolution of their marriage.
d. The same situation as inc, but now assume (which you likely did not do in c) that the same two people
can remarry each other after a dissolution of a prior marriage to each other.
e. In history, and even in some cultures today, there may be no legal restriction on the number of people to
whom one can be currently married. Does your answer to part c of this Problem and Exercise handle this
situation or must you make some changes (if so, draw a new ERD)
Ans.
a.
b.
c.
d.
e. A person can be married to multiple people simultaneously, and we still need to track the
start and end dates of these marriages
2-35. Figure 2-27 represents a situation of students who attend and work in schools and who also belong to
certain clubs that are located in different schools. Study this diagram carefully to try to discern what business
rules are represented.
a. You will notice that cardinalities are not included on tile Works For relationship. State a business rule for
this relationship, and then represent this rule with the cardinalities that match your rule
b. State a business rule that would make the Located In relationship redundant (i.e., where the school in
which a club is located can be surmised or derived in some way from other relationships)
c. Suppose a student could work for only a school tile student attend but might not work. Would the Works
For relationship still be necessary, or could you represent whether a student works for tile school she
attends in some other way (if so, how}?
d. Based on tile rules of the ERD in Figure 2-27, is it possible for a student to belong to a club located in a
school that the student does not attend? Explain
Ans.
a. Business rule: A student can work for one or more schools, and a school can employ one or more
students, but a student does not have to work for a school.
Cardinalities: The cardinality should be one-to-many between School and Student. Each school can
employ many students, and each student can work for one or more school
b. Business rule: A student can only belong to clubs that are in the school they attend.
If this rule is in place, the location of the club can be inferred from the school the student attends.
Therefore, the "Located In" relationship becomes redundant because you would know that the club is
located in the same school the student attends.
c. Alternative representation: In this case, the Works For relationship can be merged with the "Attends"
relationship by adding an attribute, such as work, to the "Attends" relationship. This attribute would
indicate whether the student works for the school they attend. The "Works For" relationship would no
longer be necessary, as this information would be captured within the "Attends" relationship.
d. Alternative representation: In this case, the "Works For" relationship can be merged with the "Attends"
relationship by adding an attribute, such as Works, to the "Attends" relationship. This attribute would
indicate whether the student works for the school they attend. The "Works For" relationship would no
longer be necessary, as this information would be captured within the "Attends" relationship.