Assignment3 ProblemsSolutions
Assignment3 ProblemsSolutions
3.19 - Consider the ER diagram of Figure 7.20, which shows a simplified schema for an airline
reservations system. Extract from the ER diagram the requirements and constraints that resulted
in this schema. Try to be as precise as possible in your requirements and constraints specification.
Answer:
(1) The database represents each AIRPORT, keeping its unique AirportCode, the AIRPORT
Name, and the City and State in which the AIRPORT is located.
(2) Each airline FLIGHT has a unique number, the Airline for the FLIGHT, and the Weekdays on
which the FLIGHT is scheduled (for example, every day of the week except Sunday can be coded
as X7).
(3) A FLIGHT is composed of one or more FLIGHT LEGs (for example, flight number
CO1223 from New York to Los Angeles may have tw o FLIGHT LEGs: leg 1 from New York to
Houston and leg 2 from Houston to Los Angeles). Each FLIGHT LEG has a DEPARTURE
AIRPORT and Scheduled Departure Time, and an ARRIVAL AIRPORT and Scheduled Arrival
Time.
(4) A LEG INSTANCE is an instance of a FLIGHT LEG on a specific Date (for example,
CO1223 leg 1 on July 30, 1989). The actual Departure and Arrival AIRPORTs and
Times are recorded for each flight leg after the flight leg has been concluded. The
Number of available seats and the AIRPLANE used in the LEG INSTANCE are also kept.
(5) The customer RESERVATIONs on each LEG INSTANCE include the Customer Name,
Phone, and Seat Number(s) for each reservation.
(6) Information on AIRPLANEs and AIRPLANE TYPEs are also kept. For each AIRPLANE
TYPE (for example, DC-10), the TypeName, manufacturing Company, and
Maximum Number of Seats are kept. The AIRPORTs in which planes of this type
CAN LAND are kept in the database. For each AIRPLANE, the AirplaneId, Total number of
seats, and TYPE are kept.
3.22 - A database is being constructed to keep track of the teams and games of a sports league. A
team has a number of players, not all of whom participate in each game.
It is desired to keep track of the players participating in each game for each team, the positions
they played in that game, and the result of the game. Try to design an ER schema diagram for this
application, stating any assumptions you make. Choose your favorite sport (soccer, football,
baseball ...).
Answer:
The following design may be used for a baseball league. Here, we assumed that each game in the
schedule is identified by a unique Game#, and a game is also identified uniquely by the
combination of Date, starting Time, and Field where it is played. The Performance attribute of
PARTICIPATE is used to store information on the individual performance of each player in a
game. This attribute can be designed to keep the information needed for statistics, and may be
quite complex. One possible design for the Performance attribute may be the following (using the
notation of Figure 7.8):
3.25 - Consider the ER diagram in Figure 7.23. Assume that a course may or may not use a
textbook, but that a text by definition is a book that is used in some course. A course may not use
more than five books. Instructors teach from two to four courses. Supply (min, max) constraints
on this diagram. State clearly any additional assumptions you make. If we add the relationship
ADOPTS between INSTRUCTOR and TEXT, what (min, max) constraints would you put on it?
Why?
Answer:
The resulting ER Diagram will have the (min, max) constraints shown in Figure B.
3.30 - Illustrate the UML Diagram for exercise 7.16. Your UML design should observe the
following requirements:
a. The student should have the ability to compute his/her GPA and add or drop majors and
minors.
b. Each department should be to able add or delete courses and hire or terminate faculty.
c. Each instructor should be able to assign or change a grade to a student for a course.
Answer:
STUDENT DEPARTMENT SECTION
Name: Name: {CS,…} Instructor
<Name> DepartmentCode: {Codes} Semester
StudentNumber OfficeNumber Year
SocialSecNumber OfficePhone: CourseNumber
CurrentAddress: <Phone> SectionNumber: {1,2,…}
<Address> College: {Colleges}
CurrentPhone:
<Phone>
PermanentAddress: add_course
<Address> delete_course
PermanentPhone: hire_faculty
<Phone> fire_faculty
Birthdate: Date
Sex: {M,F} GRADE REPORT
Class: {F,So,J,Se,G} StudentNumber
MajorDepartment SectionNumber
MinorDepartment LetterGrade: {A,B,C,D,F}
Degree: {BA,BS,…} NumberGrade: {0,1,2,3,4}
PREREQUISITE
compute_gpa CourseNumber
add_major PrerequisiteNumber
drop_major
add_minor
drop_minor
COURSE
CourseName
Description INSTRUCTOR
CourseNumber: {Course} Name:
SemesterHours <Name>
Level Phone:
Department <Phone>
DepartmentCode
assign_grade
change_grade
This one isn’t finished yet. The relationships need to be added and some of the functions should
be moved to span classes.
4.19 - Identify all the important concepts represented in the library database case study described
here. In particular, identify the abstraction of classification (entity types and relationship types),
aggregation, identification, and specialization/generalization. Specify (min, max) cardinality
constraints whenever possible. List details that will affect the eventual design but which have no
bearing on the conceptual design. List the semantic separately. Draw an EER diagram of the
library database.
Answer:
4.21 - Figure 8.12 shows an example of an EER diagram for a small private airport database that
is used to keep track of airplanes, their owners, airport employees, and pilots. From the
requirements for this database, the following information was collected: Each airplane has a
registration number [Reg#], is of a particular plane type [of_type], and is stored in a particular
hangar [stored_in]. Each plane_type has a model number [Model], a capacity [Capacity], and a
weight [Weight]. Each hangar has a number [Number], a capacity [Capacity], and a location
[Location]. The database also keeps track of the owners of each plane [owns] and the employees
who have maintained the plane [maintain]. Each relationship instance in owns relates an airplane
to an owner and includes the purchase date [Pdate]. Each relationship instance in maintain relates
to an employee to a service record [service]. Each plane undergoes service many times; hence, it
is related by [plane_service] o a number of service records. A service record includes as attributes
the date of maintenance [Date], the number of hours spent on the work [Hours], and the type of
work done [Workcode]. We use a weak entity type [service] to represent airplane service, because
the airplane registration number is used to identify a service record. An owner is either a person
or a corporation. Hence, we use a union type (category) [owner] that is a subset of the union of
corporation [Corporation] and person [Person] entity types. Both pilots {Pilot] and employees
[Employee] are subclasses of person. Each pilot has specific attributes license number [Lic_Num]
and restrictions [Restr]; each employee has specific attributes salary [Salary] and shift {Shift]. All
person entities in the database have data kept on their social security number [Ssn], name [Name],
address [Address], and telephone number [Phone]. For corporation entities, the data kept includes
name [Name], address [Address], and telephone number [Phone]. The database also keeps track
of the types of planes each pilot is authorized to fly [Flies] and the types of planes each employee
can do maintenance work on [Works_on]. Show how the small airport EER schema of Figure
8.12 may be represented in UML notation. (Note: We have not discussed how to represent
categories (union types) in UML, so you do not have to map the categories in this and the
following question.)
Answer:
4.26 - Which of the following EER diagram(s) is/are incorrect and why? State clearly any
assumptions you make.
E1
a) E o
N
1 R E3
A E2
B
E1 1
b) E d
R
E2 1
A
o
c)
E1 E3
M R N
A C
Answer: