Er Diagrams With Answers
Er Diagrams With Answers
2.)
Consider the following set of requirements for a university database that is used to
keep track of students' transcripts. This is similar but not identical to the database
shown in Figure 1.2:
a. The university keeps track of each student's name, student number, social
security number, current address and phone, permanent address and phone,
birthdate, sex, class (freshman, sophomore, . . ., graduate), major department,
minor department (if any), and degree program (B.A., B.S., . . ., Ph.D.). Some
user applications need to refer to the city, state, and zip code of the student's
permanent address and to the student's last name. Both social security number
and student number have unique values for each student.
b. Each department is described by a name, department code, office number,
office phone, and college. Both name and code have unique values for each
department.
c. Each course has a course name, description, course number, number of
semester hours, level, and offering department. The value of course number is
unique for each course.
d. Each section has an instructor, semester, year, course, and section number. The
section number distinguishes sections of the same course that are taught
during the same semester/year; its values are 1, 2, 3, . . ., up to the number of
sections taught during each semester.
e. A grade report has a student, section, letter grade, and numeric grade (0, 1,2,
3, or 4).
Design an ER schema for this application, and draw an ER diagram for that
schema. Specify key attributes of each entity type and structural constraints on
each relationship type. Note any unspecified requirements, and make appropriate
assumptions to make the specification complete.
3.)(3.21)
Design an ER schema for keeping track of information about votes taken in the
U.S. House of Representatives during the current two-year congressional session.
The database needs to keep track of each U.S. state's Name (e.g., Texas, New
York, California) and includes the Region of the state (whose domain is
{Northeast, Midwest, Southeast, Southwest, West}). Each concressperson in the House of
Representatives is described by their Name, and includes the District represented,
the StartDate when they were first elected, and the political Party they belong to
(whose domain is {Republican, Democrat, Independent, Other}). The database
keeps track of each bill (i.e., proposed law), and includes the BillName, the
DateOfVote on the bill, whether the bill PassedOrFailed (whose domain is {YES,
NO}), and the Sponsor (the congressperson(s) who sponsored—i.e., proposed—
the bill). The database keeps track of how each congressperson voted on each bill(domain of vote
attribute is {Yes, No, Abstain, Absent}). Draw an ER schema
diagram for the above application. State clearly any assumptions you make.
4.)(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, baseball, football, . . .).
5.)(3.26)
Consider an entity type section in a university database, which describes the
section offerings of courses. The attributes of section are: SectionNumber, Semester,
Year, CourseNumber, Instructor, RoomNo (where section is taught), Building
(where section is taught), Weekdays (domain is the possible combinations of
weekdays in which a section can be offered {MWF, MW, TT, etc.}), and Hours(domain is all
possible time periods during which sections are offered {9-
9.50 A.M., 10-10.50 A.M.,..., 3.30-4.50 P.M., 5.30-6.20 P.M., etc.}). Assume that
SectionNumber is unique for each course within a particular semester/year
combination (that is, if a course is offered multiple times during a particular semester, its
section offerings are numbered 1, 2, 3, etc.). There are several composite keys for
SECTION, and some attributes are components of more than one key. Identify
three composite keys, and show how they can be represented in an ER schema
diagram.
6.)(4.18)
The following narrative describes a simplified version of the organization of
Olympic facilities planned for the 1996 Olympics in Atlanta. Draw an EER
diagram that shows the entity types, attributes, relationships, and specializations for
this application. State any assumptions you make. The Olympic facilities are
divided into sports complexes. Sports complexes are divided into one-sport and
multisport types. Multisport complexes have areas of the complex designated to
each sport with a location indicator (e.g., center, NE-corner, etc.). A complex has
a location, chief organizing individual, total occupied area, and so on. Each
complex holds a series of events (e.g., the track stadium may hold many different
races). For each event there is a planned date, duration, number of participants,
number of officials, and so on. A roster of all officials will be maintained together
with the list of events each official will be involved in. Different equipment is
needed for the events (e.g., goal posts, poles, parallel bars) as well as for
maintenance. The two types of facilities (one-sport and multisport) will have different types of
information. For each type, the number of facilities needed is kept,
together with an approximate budget.
7.)(4.19)
Draw an EER diagram of the library database.The Georgia Tech Library (GTL) has approximately
16,000
members, 100,000 titles, and 250,000 volumes (or an average of 2.5 copies per
book). About 10 percent of the volumes are out on loan at any one time. The
librarians ensure that the books that members want to borrow are available when
the members want to borrow them. Also, the librarians must know how many
copies of each book are in the library or out on loan at any given time. A catalog
of books is available on-line that lists books by author, title, and subject area. For
each title in the library, a book description is kept in the catalog that ranges from
one sentence to several pages. The reference librarians want to be able to access
this description when members request information about a book. Library staff is
divided into chief librarian, departmental associate librarians, reference librarians,
check-out staff, and library assistants. Books can be checked out for 21 days.
Members are allowed to have only five books out at a time. Members usually
return books within three to four weeks. Most members know that they have one
week of grace before a notice is sent to them, so they try to get the book returned
before the grace period ends. About 5 percent of the members have to be sent
reminders to return a book. Most overdue books are returned within a month of
the due date. Approximately 5 percent of the overdue books are either kept or
never returned. The most active members of the library are defined as those who
borrow at least ten times during the year. The top 1 percent of membership does
15 percent of the borrowing, and the top 10 percent of the membership does 40
percent of the borrowing. About 20 percent of the members are totally inactive in
that they are members but do never borrow. To become a member of the library,
applicants fill out a form including their SSN, campus and home mailing
addresses, and phone numbers. The librarians then issue a numbered, machine-
readable card with the member's photo on it. This card is good for four years. A
month before a card expires, a notice is sent to a member for renewal. Professors
at the institute are considered automatic members. When a new faculty member
joins the institute, his or her information is pulled from the employee records and
a library card is mailed to his or her campus address. Professors are allowed to
check out books for three-month intervals and have a two-week grace period.
Renewal notices to professors are sent to the campus address. The library does not
lend some books, such as reference books, rare books, and maps. The librarians
must differentiate between books that can be lent and those that cannot be lent.
In addition, the librarians have a list of some books they are interested in
acquiring but cannot obtain, such as rare or out-of-print books and books that were lostChapter 4 /
Enhanced Entity-Relationship and Object Modeling
or destroyed but have not been replaced. The librarians must have a system that
keeps track of books that cannot be lent as well as books that they are interested
in acquiring. Some books may have the same title; therefore, the title cannot be
used as a means of identification. Every book is identified by its International
Standard Book Number (ISBN), a unique international code assigned to all
books. Two books with the same title can have different ISBNs if they are in
different languages or have different bindings (hard cover or soft cover). Editions of
the same book have different ISBNs. The proposed database system must be
designed to keep track of the members, the books, the catalog, and the borrowing
activity.
8.)
The university is organized into colleges (COLLEGE), and each college has a unique name
(CName), a main office (COffice) and phone (CPhone), and a particular faculty member who is
dean of the college. Each college administers a number of academic departments (DEPT). Each
department has a unique name (DName), a unique code number (DCode), a main office (DOffice)
and phone (DPhone), and a particular faculty member who chairs the department. We keep track of
the start date (CstartDate). A department offers a number of courses (COURSE), each of which has
a unique course name (CoName), a unique code number (CCode), a course level (Level: this can be
coded as 1 for freshman level, 2 for sophomore, 3 for junior, 4 for senior, 5 for MS level, and 6 for
PhD level), a course credit hours (Credits), and a course description (CDesc). The database also
keeps track of instructors (INSTRUCTOR); and each instructor has a unique identifier (Id), name
(IName), office (IOffice), phone (IPhone), and rank (Rank); in addition, each instructor works for
one primary academic department. The database will keep student data (STUDENT) and stores
each student’s name (SName, composed of first name (FName), middle name (MName), last name
(LName)), student id (Sid, unique for every student), address (Addr), phone (Phone), major code
(Major), and date of birth (DoB). A student is assigned to one primary academic department. It is
required to keep track of the student’s grades in each section the student has completed. Courses are
offered as sections (SECTION). Each section is related to a single course and a single instructor and
has a unique section identifier (SecId). A section also has a section number (SecNo: this is coded as
1, 2, 3, . . . for multiple sections offered during the same semester/year), semester (Sem), year
(Year), classroom (CRoom: this is coded as a combination of building code (Bldg) and room
number (RoomNo) within the building), and days/times (DaysTime: for example, ‘MWF 9am-
9.50am’ or ‘TR 3.30pm-5.20pm’— restricted to only allowed days/time values). (Note: The
database will keep track of all the sections offered for the past several years, in addition to the
current offerings. The SecId is unique for all sections, not just the sections for a particular semester.)
The database keeps track of the students in each section, and the grade is recorded when available
(this is a many-to-many relationship between students and sections). A section must have at least
five students.
9.)(4.25)
Draw an EER diagram for a game
of chess as described in Exercise 4. 24.
1. The game of chess is played between two players.
2. The game is played on an 8 × 8 board like the one shown below:
3. The players are assigned a color of black or white at the start of the game.
4. Each player starts with the following pieces (traditionally called chessmen): a. king b. queen c. 2
rooks d. 2 bishops e. 2 knights f. 8 pawns
5. Every piece has its own initial position.
6. Every piece has its own set of legal moves based on the state of the game. You do not need to
worry about which moves are or are not legal except for the following issues: a. A piece may move
to an empty square or capture an opposing piece. b. If a piece is captured, it is removed from the
board. c. If a pawn moves to the last row, it is “promoted” by converting it to another piece (queen,
rook, bishop, or knight).
10.)(4.28)
Consider a GRADE_BOOK database in which instructors within an academic department record
points earned by individual students in their classes. The data requirements are summarized as
follows:
■ Each student is identified by a unique identifier, first and last name, and an e-mail address.
■ Each instructor teaches certain courses each term. Each course is identified by a course number, a
section number, and the term in which it is taught. For each course he or she teaches, the instructor
specifies the minimum number of points required in order to earn letter grades A, B, C, D, and F.
For example, 90 points for an A, 80 points for a B, 70 points for a C, and so forth.
■ Students are enrolled in each course taught by the instructor.
■ Each course has a number of grading components (such as midterm exam, final exam, project,
and so forth). Each grading component has a maximum number of points (such as 100 or 50) and a
weight (such as 20% or 10%). The weights of all the grading components of a course usually total
100.
■ Finally, the instructor records the points earned by each student in each of the grading
components in each of the courses. For example, student 1234 earns 84 points for the midterm exam
grading component of the section 2 course CSc2310 in the fall term of 2009. The midterm exam
grading component may have been defined to have a maximum of 100 points and a weight of 20%
of the course grade. Design an enhanced entity–relationship diagram for the grade book database
and build the design using a data modeling tool such as ERwin or Rational Rose.
11.) (4.29)
Consider an ONLINE_AUCTION database system in which members (buyers and sellers)
participate in the sale of items. The data requirements for this system are summarized as follows:
■ The online site has members, each of whom is identified by a unique member number and is
described by an e-mail address, name, password, home address, and phone number.
■ A member may be a buyer or a seller. A buyer has a shipping address recorded in the database. A
seller has a bank account number and routing number recorded in the database.
■ Items are placed by a seller for sale and are identified by a unique item number assigned by the
system. Items are also described by an item title, a description, starting bid price, bidding increment,
the start date of the auction, and the end date of the auction.
■ Buyers make bids for items they are interested in. Bid price and time of bid are recorded. The
bidder at the end of the auction with the highest bid price is declared the winner, and a transaction
between buyer and seller may then proceed.
■ The buyer and seller may record feedback regarding their completed transactions. Feedback
contains a rating of the other party participating in the transaction (1–10) and a comment Design an
enhanced entity–relationship diagram for the ONLINE_AUCTION database and build the design
using a data modeling tool such as ERwin or Rational Rose.
12.)(4.30)
Consider a database system for a baseball organization such as the major leagues. The data
requirements are summarized as follows:
■ The personnel involved in the league include players, coaches, managers, and umpires. Each is
identified by a unique personnel id. They are also described by their first and last names along with
the date and place of birth.
■ Players are further described by other attributes such as their batting orientation (left, right, or
switch) and have a lifetime batting average (BA).
■ Within the players group is a subset of players called pitchers. Pitchers have a lifetime ERA
(earned run average) associated with them.
■ Teams are uniquely identified by their names. Teams are also described by the city in which they
are located and the division and league in which they play (such as Central division of the
League).
■ Teams have one manager, a number of coach es, and a number of players.
■ Games are played between two teams, with one designated as the home team and the other the
visiting team on a particular date. The score (runs, hits, and errors) is recorded for each team. The
team with the most runs is declared the winner of the game.
■ With each finished game, a winning pitcher and a losing pitcher are recorded. In case there is a
save awarded, the save pitcher is also recorded.
■ With each finished game, the number of hits (singles, doubles, triples, and home runs) obtained
by each player is also recorded. Design an enhanced entity–relationship diagram for the
BASEBALL database and enter the design using a data modeling tool such as ERwin or Rational
Rose. 4.31.
13.)
A university registrar’s office maintains data about the following entities: (a) courses, including
number, title, credits, syllabus, and prerequisites; (b) course offerings, including course number,
year, semester, section number, instructor(s), timings, and classroom; (c) students, including
student-id, name, and program; and (d) instructors, including identification number, name,
department, and title. Further, the enrollment of students in courses and grades awarded to students
in each course they are enrolled for must be appropriately modeled. Construct an E-R diagram
forthe registrar’s office. Document all assumptions that you make about the mapping constraints.
Answer: In the answer given here, the main entity sets are student, course, course-offering, and
instructor. The entity set course-offering is a weak entity set dependent on course. The assumptions
made are : a. a class meets only at one particular place and time. This E-R diagram cannot model a
class meeting at different places at different times. b. There is no guarantee that the database does
not have two classes meeting at the same place and time.
14.)
Design an E-R diagram for keeping track of the exploits of your favourite sports team. You should
store the matches played, the scores in each match, the players in each match and individual player
statistics for each match. Summary statistics should be modeled as derived attributes.
15.)
Consider a university database for the scheduling of classrooms for final exams. This database
could be modeled as the single entity set exam, with attributes course-name, section-number, room-
number, and time. Alternatively, one or more additional entity sets could be defined, along with
relationship sets to replace some of the attributes of the exam entity set, as • course with attributes
name, department, and c-number • section with attributes s-number and enrollment, and dependent
as a weak entity set on course • room with attributes r-number, capacity, and building a. Show an E-
R diagram illustrating the use of all three additional entity sets listed.
16.)UPS prides itself on having up-to-date information on the processing and current location of
each shipped item. To do this, UPS relies on a company-wide information system. Shipped items
are the heart of the UPS product tracking information system. Shipped items can be characterized
by item number (unique), weight, dimensions, insurance amount, destination, and final delivery
date. Shipped items are received into the UPS system at a single retail center. Retail centers are
characterized by their type, uniqueID, and address. Shipped items make their way to their
destination via one or more standard UPS transportation events (i.e., flights, truck deliveries). These
transportation events are characterized by a unique scheduleNumber, a type (e.g, flight, truck), and
a deliveryRoute. Please create an Entity Relationship diagram that captures this information about
the UPS system.
17.)http://web.cs.wpi.edu/~cs3431/c13/Quizzes/SampleMidterm.pdf
Assume we have the following application that models soccer teams, the games they play, and the
players in each team. In the design, we want to capture the following: • We have a set of teams, each
team has an ID (unique identifier), name, main stadium, and to which city this team belongs. • Each
team has many players, and each player belongs to one team. Each player has a number (unique
identifier), name, DoB, start year, and shirt number that he uses. • Teams play matches, in each
match there is a host team and a guest team. The match takes place in the stadium of the host team.
• For each match we need to keep track of the following: o The date on which the game is played o
The final result of the match o The players participated in the match. For each player, how many
goals he scored, whether or not he took yellow card, and whether or not he took red card. o During
the match, one player may substitute another player. We want to capture this substitution and the
time at which it took place. • Each match has exactly three referees. For each referee we have an ID
(unique identifier), name, DoB, years of experience. One referee is the main referee and the other
two are assistant referee. Design an ER diagram to capture the above requirements. State any
assumptions you have that affects your design (use the back of the page if needed). Make sure
cardinalities and primary keys are clear.
21.) (Ramkrishnan)
Notown Records has decided to store information about musicians who perform
on its albums (as well as other company data) in a database. The company has wisely chosen
to hire you as a database designer (at your usual consulting fee of $2500jday).
III Each musician that records at Notown has an SSN, a name, an address, and a phone
number. Poorly paid musicians often share the same address, and no address has more
than one phone.
III Each instrument used in songs recorded at Notown has a name (e.g., guitar, synthesizer,
flute) and a musical key (e.g., C, B-flat, E-flat).
III Each album recorded on the Notown label has a title, a copyright date, a format (e.g.,
CD or MC), and an album identifier.
III Each song recorded at Notown has a title and an author.
III Each musician may play several instruments, and a given instrument may be played by
several musicians.
III Each album has a number of songs on it, but no song may appear on more than one
album.
III Each song is performed by one or more musicians, and a musician may perform a number
of songs.
III Each album has exactly one musician who acts as its producer. A musician may produce
several albums, of course.
Design' a conceptual schema for Notown and draw an ER diagram for your schema. The
preceding information describes the situation that the Notown database must model. Be sure
to indicate all key and cardinality constraints and any assumptions you make. Identify any
constraints you are unable to capture in the ER diagram and briefly explain why you could
not express them.
22.)(Ramkrishnan)
The Prescriptions-R-X chain of pharmacies ha.s offered to give you a free life-
time supply of medicine if you design its database. Given the rising cost of health care, you
agree. Here's the information that you gather:
11II Patients are identified by an SSN, and their names, addresses, and ages must be recorded.
11II Doctors are identified by an SSN. For each doctor, the name, specialty, and years of
experience must be recorded.
III Each pharmaceutical company is identified by name and has a phone number.
III For each drug, the trade name and formula must be recorded. Each drug is sold by
a given pharmaceutical company, and the trade name identifies a drug uniquely from
among the products of that company. If a pharmaceutical company is deleted, you need
not keep track of its products any longer.
III Each pharmacy has a name, address, and phone number.
III Every patient has a primary physician. Every doctor has at least one patient.
• Each pharmacy sells several drugs and has a price for each. A drug could be sold at
several pharmacies, and the price could vary from one pharmacy to another.
• Doctors prescribe drugs for patients. A doctor could prescribe one or more drugs for
several patients, and a patient could obtain prescriptions from several doctors. Each
prescription has a date and a quantity associated with it. You can assume that, if a
doctor prescribes the same drug for the same patient more than once, only the last such
prescription needs to be stored.
• Pharmaceutical companies have long-term contracts with pharmacies. A pharmaceutical
company can contract with several pharmacies, and a pharmacy can contract with several
pharmaceutical companies. For each contract, you have to store a start date, an end date,
and the text of the contract.
• Pharmacies appoint a supervisor for each contract. There must always be a supervisor
for each contract, but the contract supervisor can change over the lifetime of the contract.
1. Draw an ER diagram that captures the preceding information. Identify any constraints
not captured by the ER diagram.
24.)
(Ramkrishnan)
Suppose you are given the following requirements for a simple database for the National Hockey
League (NHL): • the NHL has many teams, • each team has a name, a city, a coach, a captain, and a
set of players, • each player belongs to only one team, • each player has a name, a position (such as
left wing or goalie), a skill level, and a set of injury records, • a team captain is also a player, • a
game is played between two teams (referred to as host_team and guest_team) and has a date (such
as May 11th, 1999) and a score (such as 4 to 2). Construct a clean and concise ER diagram for the
NHL database