100% found this document useful (2 votes)
2K views6 pages

ERD Assignment Solution

The document contains solutions to 6 questions about drawing entity-relationship diagrams for various applications. The solutions involve drawing ER diagrams and specifying relational schemas to represent the relationships between entities in each application domain.

Uploaded by

zaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views6 pages

ERD Assignment Solution

The document contains solutions to 6 questions about drawing entity-relationship diagrams for various applications. The solutions involve drawing ER diagrams and specifying relational schemas to represent the relationships between entities in each application domain.

Uploaded by

zaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment Solution -01

Question: 03

The craft trading website Itsy! Bitsy! is setting up a database to record sellers and their products. This
requires recording the following information:

• For each seller, their name, contact email, and postal address.

• For each product, its name, price, and number available.

• Which product is from which seller.

• A unique id number for each product.

Draw an entity-relationship (ER) diagram that represents this information. Make sure to capture the
constraints on the relationships involved, and designate appropriate primary keys for the entities.

Solution:

P_Id Name
Postal address Email

M M
Seller Sells
Product

S_Id Name Quantity


Price

Relational Schema:

Seller( S_ID, Email, Name, Postal Address)

Product ( P_ID, Name, Price, Quantity)

Sells ( S_ID, P_ID)


Question: 04

Draw an ER diagram for the following application from the manufacturing industry:

1. Each supplier has a unique name.

2. More than one supplier can be located in the same city.

3. Each part has a unique part number.

4. Each part has a color.

5. A supplier can supply more than one part.

6. A part can be supplied by more than one supplier.

7. A supplier can supply a fixed quantity of each part.

Solution:
Quantity

Name City Part_No Color

M M
Supplier Supply
Part

Relational Schema:

Supplier (Name, City)

Part (Part_No, Color)

Supply (Name, Part_No, Quantity)


Question: 01

Draw an ER diagram for the following application from the hospital:

- A doctor has one or more patients to treat


- Each doctor has an unique Doctor ID
- Each patient has a name, phone number, address and date of birth
- Patient entity is a weak entity
- Age is a derived attribute
Solution:

Name Phone Address

D_ID Name

1 M
Doctor Treat Patient

DOB Age D_ID

Relational Schema:

Doctor (D_ID, Name)

Patient ( Name, Phone, Address, DOB, Age, D_ID)


Question: 02

Draw an ER diagram for the following application from the ABC Company:

-Employees work for many projects and each project has many employees
-Each employee has an unique Emp_No
-Each employee has a name and name consists of first name, middle name and last name
-Each project has an unique number and name

Solution:

First Name Middle Name Last Name

P_ID Name

Emp_no Name

M Works M
Employee Project
for

Relational Schema:

Employee (Emp_No, First_Name, Middle_Name, Last_Name)

Project ( P_ID, Name)

Works_For (Emp_No, P_ID)


Question: 05

A salesperson may manage many other salespeople. A salesperson is managed by only one salespeople.
A salesperson can be an agent for many customers. A customer is managed by one salespeople. A
customer can place many orders. An order can be placed by one customer. An order lists many inventory
items. An inventory item may be listed on many orders. An inventory item is assembled from many
parts. A part may be assembled into many inventory items. Many employees assemble an inventory
item from many parts. A supplier supplies many parts. A part may be supplied by many suppliers.

Solution:
Question: 06

A company database needs to store information about employees (identified by ssn, with salary and
phone as attributes), departments (identified by dno, with dname and budget as attributes), and
children of employees (with name and age as attributes). Employees work in departments; each
department is managed by an employee; a child must be identified uniquely by name when the parent
(who is an employee; assume that only one parent works for the company) is known. We are not
interested in information about a child once the parent leaves the company. Draw an ER diagram that
captures this information.

Solution:

1 1

M
M

Relational Schema:

Employees (ssn, salary, Phone, Manages)

Department ( dno, dname, budget)

Child (Name, Age, ssn)

Works_In (ssn, dno)

You might also like