CH2 Exercises Solutions
CH2 Exercises Solutions
Student Name, Address, Phone, Age, Activity, Activity represents some campus-based student activity A
given student may engage in more than one activity.
What attribute or attributes did you designate as the identifier for the STUDENT entity? Why? Which
attributes should be required?
STUDENT
Student ID
Name (First Name, Middle Name,
Last Name)
Address (Address Line, City, State,
Postal Code)
Phone (Country Code, Area Code,
Number)
Date of Birth
[Age]
{Activity}
Name may not be unique also may change over time. Student ID was added as an identifier.
Age may change over time, hence Date of Birth is added. Now Age is a derived attribute.
Modify your ER Diagram to also store data about number of years a given student has engaged in each
activity.
STUDENT
Student ID
Name (First Name, Middle
Name, Last Name)
Address (Address Line, City,
State, Zip, Postal Code)
Phone (Country Code, Area
Code, Number)
Date of Birth
[Age]
{Activity History (Activity, No. of
Years}
1
Slide 3 - An employee may have earned many degrees, but must have at least one degree. Each degree
may have been earned by many employees
EMPLOYEE DEGREE
Slide 4- An airline can be assigned to fly many flights, but each flight is flown by only one airline
AIRLINE FLIGHT
Slide 5 - The Acme Corporation operates many factories. Each factory is located in a region. Each region
can be "home" to many of Acme’s factories. Each factory employs many employees, but each of these
employees is employed by only one factory.
Slide 6 - Each of the Acme Corporation’s divisions is composed of many departments. Each of the
departments has many employees assigned to it, but each employee works for only one
department. Each department is managed by one employee, and each of these managers can manage
only one department at a time.
has
DIVISION DEPARTMENT EMPLOYEE
manages
2
Slide 8 – Adding business rules and cardinality for the works for relationship.
A school may have many students that work for the school. – Student side optional many
Slide 9 - COLLEGE - A college course may have one or more scheduled sections, or may not have a
scheduled section. Attributes of COURSE include Course ID, Course Name, and Units. Attributes of
SECTION include Section Number and Semester ID. Semester ID is composed of two parts: Semester and
Year. Section Number is an integer (such as 1 or 2) that distinguishes one section from another for the
same course but does not uniquely identify a section. How did you model SECTION? Why did you choose
this way versus alternative ways to model SECTION?
Slide 16 - Draw a data model for the PERSON entity type and the Is Married To relationship for each of
the following variations by showing the appropriate cardinalities and including, if necessary, any
attributes:
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.
3
d. The same situation as in c, 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)
The solution in c. does not place any restrictions on the number of persons to whom any
one person is simultaneously married, thus the c. solution is sufficient in representing the
lack of legal restrictions regarding the number of marriage partners.
Slide 18 - LAB - A laboratory has several chemists who work on one or more projects. Chemists also may
use certain kinds of equipment on each project. Attributes of CHEMIST include Employee ID (identifier),
Name, and Phone No. Attributes of PROJECT include Project ID (identifier) and Start Date. Attributes of
EQUIPMENT include Serial No and Cost. The organization wishes to record Assign Date—that is, the date
when a given equipment item was assigned to a particular chemist working on a specified project. A
chemist must be assigned to at least one project and one equipment item. A given equipment item need
not be assigned, and a given project need not be assigned either a chemist or an equipment item.
4
Slide 19 - ART MUSEUM - An art museum owns a large volume of works of art. Each work of art is
described by an item code (identifier), title, type, and size; size is further composed of height, width, and
weight. A work of art is developed by an artist, but the artist for some works is unknown. An artist is
described by an artist ID (identifier), name, date of birth, and date of death (which is null for still living
artists). Only data about artists for works currently owned by the museum are kept in the database. At
any point in time, a work of art is either on display at the museum, held in storage, away from the
museum as part of a traveling show, or on loan to another gallery. If on display at the museum, a work of
art is also described by its location within the museum. A traveling show is described by a show ID
(identifier), the city in which the show is currently appearing, and the start and end dates of the show.
Many of the museum works may be part of a given show, and only active shows with at least one
museum work of art need be represented in the database. Finally, another gallery is described by a
gallery ID (identifier), name, and city. The museum wants to retain a complete history of loaning a work
of art to other galleries, and each time a work is loaned, the museum wants to know the date the work
was loaned and the date it was returned.
ARTWORK is created by 0:1 ARTIST (0 for Unknown ARTIST); alternative design would be to
have a valid ARTIST instance with a Name of “Unknown”; this would enable you to enforce a
business rule that each piece of ARTWORK must have an ARTIST stored in the database and the
cardinality would change to mandatory one near the ARTIST entity in the diagram.
Item Status attribute of ARTWORK permits designation of ARTWORK as Display (and then a
valid value for Item Museum Location attribute), Storage, Loan, or Show.
An ARTWORK item may participate in a SHOW; however, there is not a way to note on the ERD
that an ARTWORK item cannot be a part of two shows with overlapping dates. This business
constraint will need to be noted as part of the system design documentation.
In the following questions, there is not a single correct answer. However, the business rules should
be consistent with the notation chosen.
5
Slide 20 - CREDIT The loan office in a bank receives from various parties requests to investigate the credit
status of a customer. Each credit request is identified by a Request ID and is described by a Request Date
and Requesting Party Name. The loan office also received results of credit checks. A credit check result is
identified by a Credit Check ID and is described by the Credit Check Date and the Credit Rating. The loan
office matches credit requests with credit check results. A credit request may be recorded before its
result arrives; a particular credit result may be used in support of several credit requests. Draw an ERD
for this situation.
Now, assume that credit results may not be reused for multiple credit requests. Redraw the ERD for this
new situation using two entity types, and then redraw it again using one entity type. Which of these two
versions do you prefer, and why?
Slide 23 - Add minimum and maximum cardinality notation to the following figure, as appropriate
Business Rule : A course must be completed by at least one employee or could be completed by many
employees.
Implications : Only data about courses that have been completed by at least one employee is of interest
to the company.
6
Course side – mandatory many
Business rule – an employee must complete at least one course, or may complete many courses.
Implications – every employee in this company should complete at least one course
Slide 25 - Add minimum and maximum cardinality notation to the following figure, as appropriate:
Business Rule: one product line must have at least one product, or many products.
Slide 26 - Add minimum and maximum cardinality notation to the following figure, as appropriate: