Review Questions - ER Model
Review Questions - ER Model
1. Explain in your own words or through an example the following terms: entity
type, weak entity, attribute, key attribute, derived attribute, multivalued attribute,
entity-relationship model.
Answer:
Entity type: A collection of entities that share common properties or characteristics. For example,
in the database of a University, STUDENT is an entity type. There are many students in a
University, and they share common characteristics such as: each one has a name, a SSN or is part
of one of the departments in the University.
Weak entity: A weak entity is an entity type whose existence depends on some other entity type.
For example, in the database of a company EMPLOYEE is an entity type. Some companies keep
information about the dependents of each employee. In this case, the entity DEPENDENT is a
weak entity, since the existence of one of its instances depends on the existence of the
corresponding instance in the EMPLOYEE entity type.
Attribute: A property or characteristic of an entity type that is of interest to the organization. For
example: name is an attribute of the entity STUDENT.
Key attribute: An attribute that uniquely identifies individual instances of an entity type. For
example SSN is a key attribute of the STUDENT entity type. Each student has a unique SSN.
Derived attribute: An attribute whose value can be calculated from another attribute. For
example, the attribute “Years of experience” for the entity type EMPLOYEE, can be derived from
the difference of the current year with the value at the attribute “Start date” (date of employment).
Multivalued attribute: An attribute that may take on more than one value for a given entity
instance. For example, “Skills” is an attribute of the entity type EMPLOYEE. This is a
multivalued attribute since an employee may have more than one skill.
2. Explain through an example (other than the ones discussed in the book) the
contrast between the following terms:
a. entity type; entity instance
b. strong entity type; weak entity type
c. entity type; entity relationship
d. simple attribute; composite attribute
e. stored attribute; derived attribute
Answer:
c. Entity relation is a meaningful association between (or among) entity types. For example, the
relation between STUDENT and COURSES OFFERED entity types is that each student in
the University takes some of the courses offered in the University.
d. Simple attributes, different from composite attributes, cannot be broken down into smaller
components. For example, consider STUDENT entity type. SSN is a simple attribute, while
Name is a composite attribute since it consists of First Name and Family Name.
e. Derived attributes, different from stored attributes, are such that their value can be derived
(calculated) from other related attribute values that are stored in the database. For example,
ALUMNUS is an entity type of the database of a University. “Years of study” is an attribute
of this entity type, whose value can be easily calculated using the attributes “Start date” (of
the studies) and “Graduation date”.
Is_Qualified
Answer:
Example:
CustomerID
Quantity Product ID Name
Name Address
5. Explain in your own words the reasons why we study the E-R model of a
database.
Answer:
Summarizes
Answer:
The above diagram is not correct. The REPORT should not be a separate entity of the database. In
fact, in the end of the semester the report are created using the information about STUDENT and
COURSE from the database. The following is the correct E-R diagram:
7. A veterinary doctor keeps the information about his clients and their pets in a
database. The following is the E-R diagram of the database.
Answer:
Answer:
PERSON Is married to
CLASSROOM
Name Address
ID
History
STUDENT
Name Address
ID
10. Discuss the criteria for choosing one of the attributes as the identifier of an entity
type.
Answer:
Some entities may have more than one candidate identifiers. The following are some of the
criteria for selecting identifiers:
1. Choose an identifier that will not change its value over the life of each instance of the entity
type.
2. Choose an identifier such that for each instance of the entity, the attribute is guaranteed to
have valid values and not to be null (or unknown).
3. Avoid the use of the so-called intelligent identifiers, whose structure indicates classifications,
locations, and so on. Such codes are often changed, which renders the identifier values
invalid.
4. Consider substituting single-attribute surrogate identifiers for large composite identifiers.
Review Questions – EER Model
Answer:
EER-models are used to represent the new modeling constructs that have been added to the original ER-
models. EER-models provide more flexibility than ER-models. EER-models allow super-type/sub-type
relationships. For example: Company XYZ has three basic types of employees: hourly employees, salaried
employees and contract consultants. Attributes if each type of employee are:
◊ Hourly employee: SSN, Name, Address, Date_hired, Hourly_rate
◊ Salaried employee: SSN, Name, Address, Date_hired, Annual_salary, Stock_option
◊ Contract consultant: SSN, Name, Address, Date_hired, Contract_number, Billing_rate
The three employee types have few attributes in common: SSN, Name, Address, Date_hired. In addition,
each employee type has one or more distinct attributes. EER-diagrams allow us to incorporate these
features of the entity type employee, into the database.
Answer:
Subtype: Is a sub-grouping of the entities in an entity type that is meaningful to the organization and that
shares common attributes or relationships distinct from other sub-groups. For example, the entity employee
has the following three subtypes: hourly employees, salaried employees and contract consultants.
Subtype discriminator: Is an attribute of the super-type whose value determines the target subtype or
subtypes. For example, the attribute Type is a subtype discriminator.
Disjoint rule: Specifies that if an entity instance (of the super-type) is a member of one subtype, it cannot
simultaneously be a member of any other subtype. This rule applies in the case of the entity employee: an
employee can either be an hourly employee, or a salaried employee or a consultant.
Overlapping rule: Specifies that an entity instance can simultaneously be a member of two (or more)
subtypes. This rule is true in the case of entity Part. A particular part type can be manufactured, as well as
can be bought from a supplier.
Date_hired Description
SSN
Part-Nr
Address Name Quantity
Type Type
EMPLOYEE PART
Type = Type =
D O
‘H’ ‘C’ ‘M’ ‘P’
‘S’
HOURLY SALARIED CONSULTANT MANUFACTURED PURCHASED
Answer:
An entity type is a collection of entities that share common characteristics. However, a major challenge in
data modeling is to recognize and clearly represent entities that are almost the same; that is entities that not
only share common properties but also have one or more distinct properties that are of interest for the
organization. This is the reason why the ER-models have been extended to include supertype / subtype
relationships.
For example: Company XYZ keeps the information about the employees in a database. Entity Employee
has three subtypes: Hourly employee, Salaried employee and Contract consultant. The three entity subtypes
have common attributes such as: SSN, Name, Address and Hiring_date, however there are attributes that
are peculiar to a particular entity type. For example, Hourly_rate is an attribute of the hourly employee type
only, or Contract_rate is an attribute of Contract consultants only.
4. The diagram below is part of the EER diagram of the University database. Is
the diagram correct? If no, explain why and draw the correct diagram.
ROOM
Capacity
D Belongs to:
Classroom_nr Office_nr
CLASSROOM OFFICE
Answer:
The diagram is not correct. Office number and classroom number are the same attribute. The following
would be the correct diagram.
Room_nr
ROOM
Capacity
D Belongs to:
CLASSROOM OFFICE
Answer:
SSN
Name
Address
Type APPLICANT
Type =
‘I’ O ‘G’
‘T’
INTERNATIONAL TRANSFER GRADUATE
Answer:
Generalization is the process of defining a more general entity type from a set of more specialized entity
types. Specialization on the other side is the process of defining one or more subtypes of the supertype, and
forming supertype / subtype relationships. Generalization rule is the opposite of the specialization rule. An
example of specialization rule is shown in the figure below. The figure shows the entity type Room
together with its attributes: Room_nr, Capacity and Belongs_to. Since Capacity is an attribute of a
classroom only and Belongs to: is an attribute of an office only, we create the following two subtypes for
this entity: Classroom and Office.
An example of generalization rule is shown in the figure below. The figure presents the entities: Graduate
student, Transfer student, International student and Freshmen. A closer look to these entities, and we can
see that they share common attributes: SSN, Name and Address. This fact suggests that these entities are
different versions of a more general entity type: APPLICANT.
Generalization
Nationality
Name SSN
Name Name
SSN SSN
Address
Address TRANSFER Address
INTERNATIONAL GRADUATE
Univ_comming_from
BS_degree
Name Nationality
SSN
Address
FRESHMEN SSN
Name
Address
Type APPLICANT
Type =
‘I’ O ‘G’
‘T’
INTERNATIONAL TRANSFER GRADUATE
Capacity Room_nr
Belongs to:
ROOM
Room_nr
ROOM
Capacity
D Belongs to:
CLASSROOM OFFICE
Answer:
SSN Type
EMPLOYEE
Yearly_Salary Type=
D University
‘FT’
‘PT’ ‘I’
FULL TIME PART TIME INTERN
Hourly_Rate
Hands-On ER Model
Problem 1
The annual Bolder Boulder is one of America’s top 10 Km races. The race is held each
Memorial Day in Boulder, Colorado. This race attracts world-class runners as well as
casual joggers. The race has grown to approximately 20,000 runners. The race is a point-
to-point race beginning at the Bank of Boulder at the northeast corner of the city winding
throughout the city streets, ending near to the town center in the University of Colorado’s
football stadium.
The organizers record the following information for each race: the date of the race, total
number of runners registered for the race (on-line pre-registration is possible), the actual
number of participants, the number of female runners, the number of male runners, the
name of the man winner, the name of the woman winner, the name of the man master
(runner of age more than 40) winner, the name of the woman master winner. In addition,
the following information about each participant is recorded as well: social security
number, name, birthday, gender, address, age and certified personal record (PR) running
times for a 10 Km race.
Draw an E-R diagram for this application. Specify the key attribute of each entity type.
Answer:
RaceID Name
Date
No. of Gender
Registered No. of
Runners Participants SSN Address
No. of Male
Runners Race Has Runner
No. of Female PR
Runners
Won by DOB
Age
Type of
Winner
Problem 2
John’s family owns and operates a 640-acre farm for several generations. Since the farm
business is growing, John is thinking to build a database that would make easier the
management of the activities in the farm. He is considering the following requirements
for the database:
1. For each livestock classification group (for example: caw, horse etc.), John keeps
track of the following: identification number, classification, total number of
livestock per classification group (for example: number of caws, number of horses
etc.).
2. For each crop the following information is recorded: crop identification number
and classification.
3. John has recorded the yield of each crop classification group during the last ten
years. The records consist of the year, yield, sales, price of the crop and the
amount of money earned.
4. John has recorded the yield of each livestock classification group during the last
ten years. The records consist of the following historical data: the year,
(historical) selling price per head, number of livestock in the end of the year,
number of livestock sold during one-year period, and the total amount of money
earned.
Draw an E-R diagram for this application. Specify the key attribute of each entity type.
Answer:
Price
Year Sales
Classification Earnings
ID Quantity
Price
Yield
ID Sales
Classification
Earnings
Year
Coca Cola Co. in Atlanta, Georgia produces a wide range of products that are delivered
to the customers once a week. The Coca Cola Co. keeps the information about the
employees, products, and customers in a database. The database considers the following
set of tables:
1. The company keeps the following information about each customer: customer
identification number, name, address, X (longitude) and Y (latitude) coordinates
of their location, amount of time (fraction of an hour) required to make a stop at a
customer, type of product that is used by a customer, mean rate at which customer
uses product per day in a week, standard deviation of this usage rate, the limit on
how much inventory of a product can be held at a customer, initial inventory of
product at a customer.
2. Each employee has an employee identification number, name, address (the
address consists of: city, state and zip code), sex, birthday, position in the
company, wage earned per hour of regular timework, wage earned per hour of
overtime work, number of dependents, and number of years working for Coca
Cola Co.
3. Each product has a product identification number, price and number of units
produced per day.
Draw an E-R diagram for the Coca Cola Co and add the minimum and maximum
relationship cardinalities. Identify the: (a) key attributes for each entity (b) composite
attributes.
Answer:
Time for
Prod Limit Customer Initial
Delivery Inventory
X - Coord
Name
Coordinates
Y- Coord
Address
CID
Product
No of yrs
No of units prod working
per day
Price
PID Wage per Wage per No. of
regular time overtime dependents
Problem 4
Consider the database given in problem 3. Update the E-R diagram for the cases
described below. For each entity identify the key attribute (attributes).
1. For tax purposes, the Coca Cola Co. will extend the data kept for each employee
to include the information about their dependents. This information consists of
dependent’s name, birthday and age.
2. The company has decided to keep information about their suppliers. This
information includes: a supplier identification number, address, name of the
contact person, X (longitude) and Y (latitude) coordinates of their location.
3. The company keeps a fleet of vehicles to facilitate the distribution of the products
to the customers. Each vehicle has an identification number, model, and capacity.
Answer:
Name
ID
Customer Supplier
Capacity Address
Date
Quantity
Product
Produces
ID
Employee
Has
Dependent
Name
BirthDay Age
Problem 5
Consider the database given in problem 3. Coca Cola Co. has few plants that are
distributed over all Georgia. For each plant the following information is stored in the
database: a plant identification number, address, X (longitude) and Y (latitude)
coordinates of plant location, type of products produced. Note that the inventory level,
inventory capacity and quantity produced of a particular product differ by plant.
Answer:
Customer
Needs
Contributes
Employee
Product
Produces
Has
Quantity
Plant
Coordinates
ID
Address
Capacity
Problem 6
Major airlines companies that provide passenger services in Taiwan are: UniAir,
TransAsia Airways, Far Eastern Transport, Great China Airlines etc. Taiwan’s Federal
Aviation Administration (TFAA) keeps a database with lots of information on all airlines.
This information is made accessible to all airlines in Taiwan with the intention of helping
the companies assess their competitive position in the domestic market. The information
kept consists of:
1. Each airline has an identification number, name and address, name of the contact
person and telephone number.
2. For each aircraft an aircraft identification number, capacity, and model is
recorded.
3. Each employee has an employee identification number, name, address, birthday,
sex, position with the company, and qualification.
4. Each route has a route identification number, origin, destination, classification
(into domestic or international route), distance of the route, and price charged per
passenger.
5. Each airline keeps information about their buy/sell transactions (for example
selling an airplane ticket is a sell transaction, paying for maintenance is a buy
transaction). Each transaction has a transaction identification number, date,
description, and amount of money paid/received.
Draw an E-R diagram for the database presented above. Make sure to identify the
associative entity (entities) and provide corresponding key attribute (attributes).
Answer:
Date
ID
Transactions Name
Description
BirthDay
Amount Position
Address
Performs ID
Address Model
Route
Distance
Classification Capacity
Name of Contact
Destination Origin ID
Price
charged
Problem 7
Consider the database described on problem 6. Each airline owns different aircraft
models and for each model aircrafts of different capacity. Depending on the length of the
route and classification (into domestic or international) the aircrafts are assigned to
different routes. The relationship between the airlines, aircrafts and routes is a ternary
relationship. Each flight carries a number of passengers, has a particular time length (that
depends on the distance of the route and the model of the aircraft), departure and arrival
time.
Answer:
Date
ID
Transactions Name
Description
BirthDay
Position
Address
Performs ID
ID Airline
Name Assign ID
Aircraft
Model
Route TimeTable
Name Capacity
Desti Origin ID
ti
Problem 8
Electronic commerce is one of the most used terms in the business world. Electronic
commerce is the buying and selling of goods and services on the Internet. One of the
most popular products for e-commerce is compact disc. This problem describes the
database of a CD warehouse.
The database will be used by the customers and company’s employees. Assume that
customers have access to company’s web site and they are able to open an account by
providing their social security number, name, address, and music preferences. Every time
a customer orders a product, the system updates the customer’s account (the amount of
money due is updated as well the name and amount of product ordered is recorded).
The products for the CD warehouse are the albums. The database keeps the following
information about each album: an album identification number, name, group name,
release date, musical category, name of the vocalist, names of the other band members,
and the number of CDs on stock.
Draw an E-R diagram for the CD warehouse database. Identify the relationship
cardinalities and the key attribute of each entity.
Answer:
Name
ID
Customer Name
Address
BirthDay
Position
Address
Buys ID
Stock Employee
ID Album Monitors
ID Address
Name
Provides Supplier
Band Name
Music Band
Company Contact
Category Members Name Name
Vocalist
Name
Problem 9
One of the three star hotels in the Miami area is in the process of updating their database.
The hotel has various rooms on each of its floors. The rooms may be regular, deluxe, or
suite type and can be either single, double, or triple. The suites have ocean view and are
bigger than regular rooms. The deluxe type rooms are as big as suites, but they do not
have ocean view and all rooms have air conditioning. Most of the rooms are non-
smoking, but the hotel has smoking rooms as well. The hotel has different number of a
particular room type in a floor. The price of each room differs by the size of the room,
view and location (first floor, second floor etc.).
The customers are charged on a per-day basis. The number of days is computed based on
the check-in time and the check-out time. The following details are stored for each
customer: name, address, type of room, check-in date, check-out date, payment method,
final bill amount, etc. . In addition to the room charges there may be extras such as
telephone, fax services, extra beds, and room service.
Draw an E-R diagram for the hotel database (state any assumptions you believe you need
to make in order to develop a complete diagram). Identify key attribute (attributes) for
each entity and composite attributes.
Answer:
Address
Name
ID
Customer
Payment
Method
o
Check in date
Occupies
Final Bill
Check Out
Type
date
Room Room
No.
The Newark divisional office of the Life Insurance Corporation of America keeps all the
necessary information about the policy holders in a database. A policy holder pays a
premium until the maturity of the policy or his death, at which time the sum assured and
bonus is paid to the nominee. The premium to be paid is worked out based on the age of
the person proposed and the term of the policy.
Newark division keeps the following information about each policy holder: social
security number, name, address, date of birth, description of the terms of the policy and
the annual premium.
The corporation has divided its Newark division into 15 zones for its convenience. Each
zone has its manager. Every zone has a number of agents allotted, typically ranging from
10 to 20. Every agent must procure a minimum of 10 customers.
Draw an E-R diagram for the Corporation database (state any assumptions you believe
you need to make in order to develop a complete diagram). Identify the key attribute
(attributes) for each entity and the cardinality of each entity relationship.
Answer:
Address Name
ID Premium
Policy Holder
Maturity
Assign
Name
Location
NR Zone Agent
Name ID
Manages
Problem 11
Ford distribution centers provide automotive parts to authorized dealers and the dealers distribute the parts
to customers throughout North America. Ford is faced with pressure to provide excellent customer service
at minimum cost. Maintaining a well organized database of information, will contribute to achieving this
goal.
Ford keeps the following information about each of its distribution centers: identification number, location
(X longitude coordinate and Y latitude coordinate), address (city, state, zip code) and name of the contact
person. The following information is kept about each dealer: identification number, dealer’s location (X
longitude coordinate and Y latitude coordinate), address (name of the city, state, zip code), name of the
contact person, and the identification number of the primary distribution center to serve this dealer.
A distribution center sends a shipment to its dealers every week. The distribution centers keep the
following information about each shipment: the date, an identification number of the product shipped, an
identification number of the dealer that receives the shipment,.
The following information is kept about each product: a product identification numbername, price, weight,
value.
Ford keeps the following information about the flow and cost data for all distribution centers to dealer
channels: distribution center identification number, dealer identification number, product identification
number, the number of miles between each distribution center and its dealers using the road network, , the
quantity of products being shipped and the dollar value of the shipment.
Draw an E-R diagram for the Ford database. State any assumptions you believe you have to make in order
to develop a compete diagram.
Answer:
Distance
Zip DC-ID Contact Zip
Date
Quantity
State State
Address Contact
DL-ID Address
City
City
Distribution-Center Ships Dealer
Value PR
Location Location
DL-ID
Value
Name Weight
Problem 12
The University Housing Office receives many applications from graduate and married
students requesting an apartment on campus. The housing villages are sited in five
different locations and each village has about 500 apartments. Each apartment falls into
one of the apartment categories. An apartment category is determined based on: village
location, whether the apartment has: dish washer or not, a single or double bedroom,
central or window unit air conditioner, furniture or not.
Housing office keeps the following information about the current residents: the SSN of
the family head, name, address, telephone number, marital status, the name of the major
college and department in which the family head is enrolled in.
Housing office keeps the following information about the students that have applied for
in campus housing, but have not been assigned to an apartment yet: SSN of the applicant,
name, address, telephone number, marital status, the name of the major college and
department in which the family head is enrolled in, the preference about the apartment
category.
Draw an E-R diagram for the University Housing Office database. State any assumptions
you need to make in order to develop a compete diagram.
Answer:
Zip
V-ID
Apt ID Category
State
City
Village Apartment
Has
Major
Resides
Applies to
Major
Pref
O
Resident
Tel No.
Applicant Tel No.
SSN
SSN Mar-Status
Mar-Status
Name Depart.
Name Depart.
Problem 13
This database includes information about the course timetable of an academic institution.
For each course the following information is recorded: an identification number, name of
the course, name of the teacher assigned to teach the course, the number of periods each
week it will be taught, the number of students attending the course, and the name of the
group of courses to which it belongs.
For each teacher the following information is recorded: SSN, name, name of the
department he/she works with, skills, the yearly salary. For each class period the
following information is recorded: period number, starting time, ending time. For each
room the following information is recorded: room number, room type (classroom, office,
auditorium, and computer lab), capacity.
The above information is used in order to make the right assignment of a teacher that
teaches a particular course to a time period and a classroom. Draw an E-R diagram for
this database. State clearly any assumptions you make.
Answer:
C-ID
Assign
Professor Capacity
Classroom
Salary
SSN
Name RoomNr Type
Skills
Depart.
Problem 14
A database is being constructed to keep track of the teams, players and games of the
national intercollegiate football championship. For each football player the following
information is recorded: SSN, name, address, birthday, position he plays on the team, ,
the number of years he is playing with the team,.
For each team that participates in the football championship the following information is
recorded: name of the team, name of the coach, name of the university it represents, the
rank of the team in the current season, number of games the team won and number of
games the team lost in the current season.
The database keeps information about the team coach. This information includes: SSN,
name, address, age, , number of years of coaching the current team, total number of years
of coaching, number of times the team he/she lead won a championship,.
The following information is recorded about each game: the date and place of the event,
winning team, , and the result (the score) of the game.
Draw an E-R diagram for this database. Clearly state any assumptions you make.
Answer:
Name Winner
GID Start-time
No. of Wins Rank Date
End-time
No. of losses
Team Game
Plays
University No of yrs
Coaches coaching the
Plays for SSN team
Coach
No of yrs
Player coaching
Consider the database described in problem 14. Each player of a football team not only
plays for a college, but in the same time is enrolled in that college. This is an example of
multiple relationship entities. Update the E-R diagram to count for this information.
Answer:
Name Winner
GID Start-time
No. of Wins Rank Date
End-time
No. of losses
Team Game
Plays
No of yrs
Coaches coaching the
Plays for SSN team
Coach
Belongs to No of yrs
Player coaching
Enrolled
University Name
Problem 16
Consider the database described in problem 14. Suppose we want to design an attribute
for the coach entity type to keep track of previous employments. Such an attribute will
have one entity for each college he/she worked with. Each entry will be composed of
college name, start and end date of employment, title of the position (coach, assistant
coach, etc.).
This problem shows that composite and multi-valued attributes can be nested to any
number of levels. Design an attribute to hold this information.
Give an alternative design for the attribute described above that uses only entity types
(for example weak entity type) and relationship types.
Answer:
Name Winner
GID Start-time
No. of Wins Rank Date
End-time
No. of losses
Team Game
Plays
University No of yrs
Coaches coaching the
Plays for SSN team
Coach
No of yrs
Player coaching
Start Date
Name O
JobSearch.com is an internet based company. The company provides information about opened positions to
students looking for a job and in the same time provides information about candidates to the companies.
Both companies and the students can access the database. Students access the database to post their resume
and look for opened positions in their area of study. Companies access the database to post their job
openings as well as to look for the candidates that best fit their needs.
For every student the following information is kept in the database: student identification number, name,
birthday, telephone number, address, e-mail address, gender, country of citizenship, immigration status,
university, major department, degree program, skills.
For every company the following information is recorded: name, address (street, city, state, zip code),
telephone number, website address, and industry. When a job opening is submitted, the companies specify
the following: posted date, job description, type of job (full time, part time, co-op etc.), and number of
openings. A contact person that works with the company looks into the database, chooses candidates,
schedules the interviews and interviews the students.
Draw an E-R diagram for the JobSearch.com database. Clearly state any assumptions you make.
Answer:
Type Name
PID
Skills
Description
Address SSN
Posted Date
University
Contact-person
Position Student
Seeks
Birthday
O
Skills
Offers
Gender
Immigration
Status
Major
Company Web-Address Dept.
Citizenship Degree
Telephone
program
Address Industry
Name
Zip City
CID
State
Problem 18
Florida Bus Traveling Agency needs to computerize their reservation database systems.
The corporation has 18 buses spread over 20 routes to various destinations in Florida.
There are two types of buses: regular and super deluxe. It has 10 regular buses, with 48
seating capacity and 8 super deluxe buses with 36 seating capacity.
For each bus the following information is stored in the databaseBus Nr, Capacity and
Type.
The buses travel certain routes. For each route the following information is recorded:
route identification number, name of the city of the origin, name of the destination, and
type of bus that is assigned on that route.
Customers usually book trips that do not necessary have to correspond to bus routes. A
trip starts in one of the cities that is visited by a route (not necessary the city of the origin
of the route), and ends in another city visited by that route (not necessary the city of the
destination of the route). For every trip that a customer books his/her ticket for, the
following information is recorded: trip identification number, city of origin, city of
destination, departure time, and arrival time.
Draw an E-R diagram for the Florida Bus Traveling Agency database. Clearly state any
assumptions you make.
Answer:
Route-ID
Bus-Nr
Origin Capacity
Destination
Type
Route Bus
Assign
Trip Departure-time
Trip-ID
Arrival-time
Origin
Destination
Problem 19
SunRise hotel is located in Palm Beach. The hotel keeps a detailed database of the rooms and special
services offered, as well as a database of employees and customers. Keeping a detailed database of the
rooms helps better managing the everyday activities of the hotel. The customer information (such as name
and address) is used to notify the customers about special promotions.
The hotel keeps information about each customer: identification number, name, address, telephone number,
birthday, identification number of the room he/she stayed in, the checking in date and time and checking
out date and time.
For every room, the following information is recorded: room identification number, location (first floor,
second floor, etc.), status (available or not available), rate, room type (regular or luxurious), ,
The hotel offer special services to customers if requested. For the special offers the following information
is recorded: identification number, rate, service type.
Draw an E-R diagram for the SunRise hotel database. Clearly state any assumptions you make.
Answer:
Location
Address Nam e
Type
Uses
Check-in Rate
O Special-Service
Type
Service-ID
Description
Problem 20
GERU is a regional multi-service utility providing electric (E), natural gas (NG), water (W), and
telecommunications (T) services to its customers. GERU is interested in keeping a database of customers,
services provided and rates. This database will help GERU maintain their operations and also enable the
customers to track their energy consumption, check their payment history, report power failures and tap
into an array of services and useful information.
The customers are classified into four major groups: domestic (D), commercial (C), agricultural (A) and
Industrial (I). Currently GERU has 4,500 domestic, 1,200 commercial, 100 agricultural and 500 industrial
connections. For each customer the following information is recorded: identification number, name,
address, classification, type of services offered, and the date s/he first signed in with the company.
Each connection offered by GERU has associated characteristics and rates that depend on the customer
classification (for example: domestic rates differ from the industrial rates) and the type of service. For each
connection with a customer the following information is recorded: connection identification number,
customer identification number, amount of gas, water, etc. consumed in a particular month, amount of
money due, and due date.
Draw an E-R diagram for the GERU database. Clearly state any assumptions you make.
Answer:
Type
Address Name ID
Sign-in
The VedMed is a Veterinary Hospital. The hospital keeps a database of their clients, pets, employee, and
inventory. This information is used to provide a better customer service and mange the everyday
operations.
The database includes the following information about each of the customers: customer identification
number, name, address, telephone number, and e-mail address. The database records the following
information about each pet that visited the hospital: pet name, type, and birth date. In addition, for each pet,
a history of the visits to the doctor is kept. For each visit, the date, type of service offered, additional
comments and payment amount is recorded.
Detailed records about the doctors working with the hospital, is kept on the database. Part of this
information is made available to the customers in order to help them with choosing a doctor that better fits
their needs. The doctors’ database includes: doctor’s identification number, name, address, gender, area of
specialization, degree earned.
After visiting a pet, the doctor wrights a prescription. The prescription includes the name of the pet, name
of the doctor, description, name of the medication and the quantity recommended by the doctor.
The hospital has a pharmacy where the customers buy the medications. For every item in the inventory, the
following information is recorded: identification number, name, description, price, quantity on hand and
safety stock level.
Draw an E-R diagram for the VedMed Hospital database. Clearly state any assumptions you make.
Answer:
SSN
Name
Address Name Type Birthday
E -mail
Customer Pet
Has
Date
Safety Stock Buys
Description
O Visits
Quantity on
hand Medicine Price
Description
Degree
Doctor
ID Address
Name Price Specialty
“Memorabilia” is an on-line company that buys sports items from different producers
around the country and sells them to on-line customers. Customers visit Memorabilia’s
website, select an item and set an order. As soon as the customer’s order is received, the
product is delivered to the customer and the inventory level is updated. The company
orders a particular product from a supplier when the inventory level drops below a certain
level.
The company has decided to keep a detailed database of the customers, suppliers and
products that would help in managing the operations. The following information is kept
into the database:
1. Customer: name, address, birthday, gender, preferred sport, and a history of the
items bought from Memorabilia.
2. Supplier: supplier identification number, name of the company, address,
3. Product: product identification number, price per unit, amount in the inventory,
amount ordered to the suppliers but not yet received, amount required by the
customers but not yet shipped.
4.
Draw an E-R diagram for Memorabilia’s database. Clearly state any assumptions you
make.Answer:
Name Description
Inventory
P-ID
Product Quantity to
be recieved
Quantity to
be Shipped
Provides
Orders
Gender
Preferred
Sport Customer Supplier
Address
C-ID Name Address SID
Name
Problem 23
A small size bookstore has been keeping track of its business mainly on paper. The owner is planning to
grow the business and would like to have a state-of-the-art database system, which would improve the
bookkeeping and service to customers.
As a caring bookstore owner she would like to send information about new books, new editions of a book,
or deals to the customers based on their profile. If the customer were a faculty member at a university then
she would like to offer free copies of a new textbook or a new edition of an existing textbook. If the
customer were a student who likes reading science fiction she would like to send monthly notices about
new releases. The system will help the store maintain details about books, publishers, customers, receipts/
payments, etc. A book may be a textbook, a novel, a comic, a children’s book, or a cookbook. Publishers
are the suppliers of the books. The bookstore buys books from different publishers. Typical customers of
the store are libraries, institutions, or individuals such as students, faculty, and others. Customers may open
an account with the store if they wish and they will be given a customer number. With their customer
number and a password that they will set, the customers will be able to login to the database using their PC
at home. They will be able to search books, place orders, check their account status, and also submit
reviews about books they have read.
The database keeps record of the sell/buy transactions. For example, when the customer places an order, a
payment is made. In the case that the inventory level for a particular book drops below a certain limit, the
bookstore places an order to the publishers for new copies.
Identify the entity types of the bookstore database. For each entity type, identify corresponding attributes.
Draw an E-R diagram. Identify the multiple relationship entities.
Answer:
C-ID B-ID
Customer Book
Buys
Subject
Publisher
Address
Name ID
Problem 24
Medicare is a medical service program that provides acute care for hospitalization, visits to a doctor’s
office, medical tests, and a limited amount of skilled nursing care for patients recuperating from an acute
illness. Medicare program covers 12 federally mandated services and several optional services. Medicare is
developing a database management system that will help: confirming patient eligibility; assigning a doctor;
paying doctors, pharmacists, and hospitals promptly.
The system should be designed to structure, store, retrieve, and analyze critical Medicare management
information such as information about patients, doctors, pharmacies, drugs etc. The system stores the
following information about:
1. Patients: identification number, name, address, birthday, gender, the identification number and
name of the doctor in charge, the date of signing up with the Medicare program and the annual
income.
2. Patient history: the patient’s identification number and name, and for each visit to the doctor: the
date of the visit, the duration of the visit, diagnose and the medication.
3. Doctors: identification number, name, address, gender, birthday, the field of study.
4. Pharmacy: identification number, address, telephone number, name of contact person.
5. Pharmacy inventory (for every drug kept in the inventory): identification number, name, price,
date of the last purchase, amount in the inventory, and the amount ordered (not received yet).
6. Sell transactions at a pharmacy: the date of the transaction, identification number and name of the
drug, , name of the patient, price and quantity purchased.
Answer:
Sign up
Name of
date Address PID
Name Address Gender Birthday contact
P-ID
Pharmacy Telephone
Gender Patient
Buys Amount
Duration Diagnose
Quantity
Visits Amt
Date Medication ordered
Date
Doctor Birthday Amt in
Gender Drug
inventory
D-ID Address
Name
Name Price DID
Field of
Study
Problem 25
Consider a wood panel manufacturer who produces a furniture grade particle board. Each
of the panels consists of a middle layer and two surface layers, which are symmetrical.
To enhance its mechanical properties each panel has several stratums of different
materials, compositions, and specific gravity. A panel’s quality can be controlled by
specifying different density profiles and raw material requirements. There are eight
different types of raw materials and your database keeps information about their
suppliers, quantities available, quantities needed, and the maximum capacity of the
bottleneck equipment. The raw material needs can be supplied from six different sources
including sawdust, shavings, sawmill, residual, chips, and short or long logs (softwoods,
hardwoods). The database should keep a detailed matrix of specifications that shows the
quantity of each individual raw material allowable in various layers of the different
products.
Another variable that affects the production schedule is the production capacity. The
database keeps truck of each equipment production capacity, equipment type (name),
maintenance date, and a description of its activities.
Draw an E-R diagram of the manufacturer database. Clearly state all the assumptions you
need to make in order to build the database.
Answer:
Maintenance
Name Capacity
Has
E-ID RM-ID
Equipment
Raw Material
Assign Type
Specification Quantity
Has
Product
P-ID
Name Description Supplier
Address
S-ID Name
Problem 26
The housing office has decided to build a database management system that will help
with assigning students to dormitories. In particular the new system will review students’
preferences for their assignment (for example: AC preference, dorm preference and room
preference) as well as their record from previous years (for example: payment history,
history of rule violations or damages etc.) to determine placement. These factors will be
recorded as student information and residential history.
There are ten dormitories in the campus. Each dormitory is classified into: married
couples, males only, females only and for co-ed. Each dormitory has up to four floors
and each floor has up to ten apartments. An apartment is classified as: single, double or
triple room apartment. Some apartments have air conditioning. Each apartment has a
pre-set yearly cost and students make one payment for their one-year stay.
Answer:
Address Preference
Name
SSN
Student History
Applies to
DID
Type
Dormitory APT
Cost
Name Has
Apartment
Type
Problem 27
People have bet on the outcome of horse races as long as horses have raced and they have
tried to earn large profits from their bets by finding ways of outwitting other betters. A
large number and variety of books have been published on horse races and each author
claims that following his/her methods will lead to profits. So far you have not been able
to make big profits using any of the existing methods. Therefore, you decided to build
your own system that would help you place sophisticated bets.
Horse racing is one of the most documented sports. There are thousands of pieces of data
published on each upcoming race. This data is available to you and you need to build a
database to keep all this information.
1. For each horse, the following information is recorded: name, owner, height, breed
(what kind of horse is it? Arabian, English?), parents, a history of races attended,
races won, etc.
2. For each jockey: SSN (social security number), Name, weight, height, age, the
number of years has s/he been racing, , etc.
3. For each racetrack: name, location (address), type (dirt, turf, etc.), distance and so
on.
4. For each race: name, distance, , where does it take place, , attendance, prize
amount, the winners of each race, etc.
Answer:
Birthday Races
Height Owner Participated Races
Name
Breed Won
H-ID History
Horse Has
Distance Parents
RID
Location
Race Assign
Prize
Distance
Date
Name Racetrack
Location
Weight
Winner Jockey
Prize Height Name Type RTID
Name Years
SSN
Racing
Problem 28
The United States Tennis Association (USTA) is concerned about developing a ranking
system of the tennis players, which is objective, consistent and broad-based. These
qualities are important in a ranking system since rankings directly affect the acceptance
of a tennis player’s entry and his/her placement in the draw.
USTA uses a particular formula to give the ranking points for each player. The formula
uses the following information: number of tournaments played by the player, tournament
points earned, number of matches played, number of wins of the player (say player “i”)
over player j. The strength of the tournament is a function of the quality of the players
and the size of the tournament.
The new system’s performance relies in the efficiency of the database. The database
keeps record of the following information:
1. For each player: social security number, name, tournament points earned, number
of matches played, number of tournament played, current ranking, age, weight,
height,.
2. For each court: name, type (grass, clay, hard surface, …), location, etc.
3. For each tournament: name, location, and tournament strength.
Build an E-R diagram for the database described above. Clearly state your assumptions.
Answer:
Matches
won Birthday
Weight
Name Rank Height
Matches
Participation played
Assign
Winner Date
Court
Location
Tournament
Name Type
Name
Location Strength
Problem 29
The traditional MBA program has been receiving criticism, because it is focused on analytical
training. However, the employers are looking for executives with broader education. The
American Assembly of Collegiate Schools of Business (AACSB) requires the following
components in an MBA curriculum: common body of knowledge in management, a field of
specialization, general competence for overall management.
Most of the schools are trying to improve their MBA programs and this is not an easy task. As a
first step through this process, AACSB has identified building a database that contains
information about students and alumni, schools and courses offered etc. This information will be
useful in preparing the new curriculum for the MBA program.
1. For each school: name, current curriculum, number of MBA graduates every year, size of
their library, budget allocated for the MBA program, location (suburban, major city, etc.),
whether it is AACSB accredited or not. (AACSB accredit those schools that meet certain
requirements. Being AACSB accredited is important for schools since it is an indication
of their quality.)
2. For each alumnus: name, SSN, school she/he graduated from, current position, current
salary, GPA at graduation, etc.
3. For each course: name, code, type of course (foundational, functional, general, sectoral or
institutional), topics covered, etc.
4. For each of the current student: SSN, name, current GPA, courses completed, the date
she/he started the program, expected graduation date.
5. For the current curriculums: curriculum code, the courses offered, etc.
Draw an E-R diagram for this database. Clearly state any assumptions you make.
Answer:
AACSB?
Location Budget
History
Name
School Has
SSN
Name Has Offers
Has
GPA
Grade Student GPA
Alumnus
Blue Bell is a large apparel manufacturer. They manufacture jeans and several other lines of sports and
casual apparel for men, women and children in the USA and have a substantial international business. Each
of the above production lines breaks down into styles, lots and sizes and stock keeping units (SKU). With
time the management realized that the number of product lines, styles, and SKUs had grown tremendously.
The production process had incorporated several new automated manufacturing operations in response to
change in the customer tastes. The management was concerned about the high investment in working
capital. A large part of the working capital is inventories. In this process of extending the business, crucial
for Blue Bell is an effective coordination of their activities. A well organized database management system
will help Blue Bell to manage their inventories. The database includes the following entities:
1. Production line: name (for example, jeans, t-shirts, swimwear etc.) and identification number,
classification (for example, menswear, womenswear, boyswear and kids).
2. Lot number: identification number, name (for example blue, green etc.), classification.
3. Product: identification number and name, size, inventory level and monthly production.
4. Customer: identification number, name, address, and telephone number.
5. Transaction: transaction date, name of the customer, type of product sold, the amount sold and the
corresponding value (in $).
Draw an E-R diagram for the Blue Bell database. Clearly state any assumptions you make.
Answer:
Tel-Nr Address
ID Name
Name ID
Customer Production-Line
Date Classification
Comes
Value Buys from
ID
Inventory Product Belongs to Lot
ID Name Name
Size
Hands-on EER Model
Problem 1
The main library of a university is interested in developing a database management system. The library
carries the following items: books, journals, conference proceedings, reference textbooks, and copies of
some recorded lectures on CD. These items are loaned to members in various categories.
The library has a total of 250,000 items. The library uses a coding scheme for classifying the items. Using
this code the librarian will be able to identify the type of the item (book, journal, CD, etc.), the subject, the
title, the author(s), whether the item is on loan, overdue, or on shelf.
Members of the library are under-graduate and graduate students, faculty members, staff, part-time
students, and visiting scholars. All members are issued an ID card by the university which can also be used
at the library. Students and visiting scholar renew their ID card every semester. Faculty and staff ID are
valid as long as they are still employed. The database records SSN, name and address of each member.
A member who borrows a CD cannot take it outside the library and has to use the computers in the library
to watch it. Journals and conference proceedings can be borrowed for 2 days, reference textbooks can be
taken on loan overnight only. Faculty and graduate students can borrow books for a period of 3 weeks,
other students and visiting scholars can borrow them for 2 weeks, and staff can borrow books for 1 week
only. Note that different than books, Journals do not have a single author. Journals are published few times
in a year.
Draw an EER diagram for the university library database. Clearly state your assumptions.
Answer:
PublicationDate
ID SSN
Type = Borrows
D ID-Renew?
‘B’ ‘J’
‘C’
BOOK CD JOURNAL
A financial institution offers different investment schemes to its customers such as shares and debentures.
The company also accepts fixed deposits from the general public, institutions, and its employees. The
company keeps a database with valuable information about its customers (such as ID, name, and address)
and financial instruments.
Fixed deposits have varying terms of 1, 2, or 3 years. For fixed deposits there are currently two payment
schemes. Under the first scheme, the investors get the principal plus the interest on maturity. Under the
second scheme, they get the principal on maturity, but interest is paid periodically. The interest rates for
fixed deposits under the first scheme may be paid quarterly, semi-annually, or annually. Investors have the
option to renew their deposits on maturity.
The company also raises debentures periodically. The debentures may be either convertible or non-
convertible. Convertible debentures can be converted to equity shares on completion of the period.
Debentures are issued for periods of 1, 2 or 3 years.
The company also calls for shares periodically. The company issues two kinds of shares: equity shares and
preferred shares. The dividend is declared at the end of the year. The system keeps track of the dividend
rates, dividend issued to the shareholders, etc.
Draw the EER diagram of this database. Identify (if any) the subtypes of entity financial instrument and
member. Identify one (or more) unique attribute (relationship) for each subtype as well as one (or more)
attribute that is shared by all entity subtypes.
Answer:
ID
INVESTMENT MEMBER
HAS
Type =
D D
‘S’ ‘D’
‘F’
SHARES FIX-DEPOSIT DEBENTURES
EMPLOYEE INSTITUTION
The database system keeps track of the inventory levels, the backorder level (orders not satisfied yet), and
the number of outstanding orders (orders that are not received yet). This information is used by the
management to decide when and how much to produce.
Other than the information about the products, the database keeps information about the raw materials,
suppliers and customers. For each type of raw materials, the database keeps the following information:
identification number, name, price per unit, identification number of the product that it is used on, and
name of the suppliers. For each supplier, the database records: supplier identification number, name,
address, orders and payments history.
The company sells its products in Venezuela as well as in USA and other Latin American countries. For the
international customers, the company provides special packaging, and charges different rates. For each
customer the following information is recorded: identification number, name, address, orders and payments
history.
Draw an EER diagram for the database described above. Clearly state any assumption you make.
Answer:
Gem Marble
Color
Produced from
Name
RAW MATERIAL
Price per
unit
Provides
SUPPLIER
SID
Name Address
The medical school at the University of Florida serves the students as well as the public as a medium sized
hospital. The hospital stores information about patients such as name of the patient, address, date of visit,
doctor’s name, etc. in a database. The hospital does not charge the students for their services and charges
special rates if the patient is a faculty member or staff at the University of Florida.
Data about wards, equipments, and operating rooms are also maintained. The hospital has three types of
operating rooms used for major, minor and small operations, respectively. There are two types of wards:
general and special. The hospital has 55 general wards and 35 special wards. The general wards have a
capacity of eight beds each. The special wards have one or two beds. The hospital also has an intensive care
unit with a capacity of 4 beds. The patients are charged on a per day basis and the rates depend on the type
of the wards.
The hospital uses the following equipment to examine the patients: the X-ray machine, the CT-Scan
machine and the ultrasonic imager. Patients are charged in case they use these equipments. The charges are
based on the number of hours the machine is used. The X-ray machine costs $350 an hour. Each hour of the
CT-Scan machine is $750 and the ultrasonic imager is $150 an hour.
Draw an EER diagram for this database. Clearly state any assumptions you make.
Answer:
ID SSN
ITEM PATIENT
Type = USES
D
NrOfHrsUsed ‘E’
‘OR’ PriceReduction
‘W ’
EQUIPMENT WARD OPERATING
ROOM
Description
NrOfBeds Size
LengthOfStay
Problem 5
National Car Rental keeps a detailed database of its inventory (cars to rent) and
customers. Customers rent a car mainly for two purposes: business and leisure. For each
customer, National records: identification number, name, address, telephone number. If
the customer rents the car for business purposes, in addition to the above information,
National records the name of the company, and the work phone number of the customer.
In order to provide a better service to the customers, National prioritizes bookings based
on length-of-rent (LOR).
National offers to the customer different types of cars such as: luxury, midsize, and
economy cars. For each type of car, the company calculates protection level. A protection
level is the number of cars that should be reserved for the demand in the current class.
The company keeps track of the number of cars of a particular type available as well.
National charges customers a daily rate depending on the type of car they rent and LOR.
Draw an EER diagram for this database. Clearly state your assumptions.
Answer:
ID SSN
Name Address Name
Type
History
Date Price
Rate
CAR CUSTOMER Purpose
Inventory RENT
ProtectionLevel
O
LOR RID
BUSINESS
WorkTel Company
Problem 6
All academic departments in a University keeps a database of its students. Students are
classified into undergraduate, graduate, and international students. There are few reasons
for grouping the students into these three categories. For example the department’s
secretary informs: the undergraduate students about new undergraduate courses offered,
the graduate students about graduate courses and professional conferences and
international students about new emigration laws.
Identify (if any) the subtypes of entity students. Identify a unique attribute (relationship)
for each subtype. Draw an EER diagram for the department’s database.
Answer:
SSN
Address Name
Type Department
STUDENT
O
‘U’
‘I’
‘G’
UNDERGRAD GRADUATE INTERNATIONAL
Blood bank is a critical entity in providing required type of blood to the patients at critical time. Their
database keeps track of the inventory of the blood, together with relevant information like blood group,
date received, location, date of expiry, donor, etc.
The database keeps information such as name, address, and telephone number of other blood banks in the
area. The reason for doing so is to get blood of a particular type from other banks in case of emergency.
Information about donors is recorded as well. Donors are classified into occasional and regular donors. For
the regular donors, the database keeps information such as identification number, blood type and a history
of their donations.
A list of healthcare providers in the area along with information such as: address, telephone number etc. is
kept. The healthcare providers are the customers of the blood bank. They keep track of the blood
transactions performed. These transactions are classified into: normal transactions and unexpected
transactions (for example, the motor accidents during the holiday season). The reason for keeping track of
the unexpected transactions is to use this information in estimating the extra amount of blood to keep in the
inventory for each age group during the coming holiday season.
Draw an EER diagram for this database. Clearly state your assumptions.
Answer:
Date
Received
Inventory Date
BID Description
Received
ID
Blood BLOOD
Group HC-PROVIDER
Name
ExpirationDate
Transacts Address
Donates
Type
Name DONOR
B-BANK Tel No.
SSN ID
Address
D Address
Name
Regular Occasional
Blood
History Group
Problem 8
YXZ is a manufacturing company. The company keeps a list of employees as well as a list of jobs that are
scheduled in a particular day. Everyday the management gets a list of jobs required to be done and list of
employees who are available. A job is then assigned to the employee that has the skills needed to doing the
job (i.e., employee should have enough skill to perform the job assigned). We want to build a database that
will make easier the process of assigning employees to jobs.
Employees are classified into three main groups: managers, engineers and workers. Managers take care of
managerial issues, engineers are the highly qualified employees that direct production processes, and the
workers perform jobs that do require some technical skills.
Jobs are classified into jobs that require: high level of technical skills, moderate level of technical skills,
and managerial skills. The classification of employees and jobs into groups facilitates the process of
assigning an employee to a job.
Draw an EER diagram for this database. Identify (if any) the subtypes of entity employee. Identify one (or
more) unique attribute (relationship) for each subtype as well as one (or more) attribute that is shared by all
entity subtypes.
Answer:
SSN
Department
Type
JOB
EMPLOYEE
Classification
Type = Performs ID
Supervise O
‘M’
‘E’ ‘W’
MANAGER ENGINEER WORKER Date
Degree TechSkills