ER Diagram Practice Sheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

ER Diagram Practice

Problem 1:

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.

Problem 2:

A university registrar’s office maintains data about the following entities:

1. courses, including number, title, credits, syllabus, and prerequisites;


2. course offerings, including course number, year, semester, section number,
instructor(s), timings, and classroom;
3. students, including student-id, name, and program;
4. 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 for the
registrar’s office. Document all assumptions that you make about the mapping constraints.

Problem 3:

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

Show an E-R diagram illustrating the use of all three additional entity sets listed.
Problem 4:

Draw the E-R diagram which models an online bookstore.

● Books are written by at least 1 author and published by only 1 publisher. Books have
year, title, price, ISBN.
● Customers have a shopping cart, where they can add books. They can add more than
one book of the same title at the same time.
● The books are stored in a warehouse; there are multiple warehouses in different
locations.

Problem 5:

A pet store wants to design a database system for inventory and sales tracking. The
requirements for the store are given below:

● The store sells different kinds of pets. The pets have a name, type, description, tag
number, price and cost
● Different suppliers supply the pets to the store. The supplier name, location and phone
numbers are stored. Also, the shipping time and date from supplier is recorded.
● The store keeps record of all customers- national_id, name, address, email and
contact.The customers can buy 1 or more pets from the store. The delivery date and
time for the purchase is also recorded.
● The pets are often taken to the Vet in case of diseases or checkups. The vet address,
name, phone, fees are stored. For each visit to the vet, the date, time, medicine and
reason is recorded.

Draw an ER diagram for the pet store. Show at least 1 multivalued and 1 composite attribute.
Write down all assumption(if any).

You might also like