You are on page 1of 3

Lab 2

Normal forms and ERD


Exercise 1. You have been given a form which shows the details of technical jobs carried out
for different schools by members of staff in the local college. You will note that one job may
require input from more than one member of staff. Each member of staff belongs to a department
within the college and the number of hours worked on each job along with the date the job was
undertaken are noted. A member of staff may work on more than one job on any given date.

The college would like to set up a relational database to manage the allocation of staff to jobs
and keep a more efficient record of the number of hours worked for each school within the
college.

a. Give the list of functional dependencies

b. Assume that at the beginning, the database contain only one relation R(TechNo,
TechName, DeptID, Department, JobNo, Date, SchoolID, School, Hoursworked).
Normalize the database to 1NF, 2NF and 3NF (specify your responses step by
step, not only give the results).

TechNo TechName DeptId Department JobNo Date SchoolID School Hoursworked

298 Walls, Ian 1 Engineering 1002 12/9/07 192 Beauty 2.5

298 Walls, Ian 1 Engineering 1003 12/9/07 125 Computing 5.5

345 Smith, Alan 2 Helpdesk 1002 12/9/07 192 Beauty 3

345 Smith, Alan 2 Helpdesk 3440 18/9/07 346 Bus & Man 1.5

345 Smith, Alan 2 Helpdesk 1480 15/9/07 192 Beauty 3

380 Jackson, 3 Labs 3670 19/9/07 560 Design 4


Bob

380 Jackson, 3 Labs 3440 18/9/07 346 Bus & Man 2


Bob

300 Jones, Joe 2 Helpdesk 1450 15/9/07 125 Computing 1

300 Jones, Joe 2 Helpdesk 1480 15/9/07 192 Beauty 3

320 Young, Jill 3 Labs 3440 18/9/07 346 Bus & Man 4

320 Young, Jill 3 Labs 1002 12/9/07 192 Beauty 2.5

320 Young, Jill 3 Labs 3670 19/9/07 560 Design 2


Exercise 2. You are required to design a database for storing data of a clinic. For the first time
a patient come to the clinic, he/she is required to fill the following form. Note that the patient
must give a reason for each visit to the clinic.

Patient Consultation Form

Date: ______________________ Time: ______________________

Name: ___________________________ Address: ______________________________________

Phone: ___________________________ Email: ________________________________________

Social Security Number: _______________ Date of Birth _____________ Age ________________

Sex: _________________________ Ocupation: _________________________

Emergency Contact:

Name: _________________________ Relation: ________________ Phone number: ___________

Main reason for today’s visit: ________________________________________________________

In each visit, the patient may be consulted by a main doctor who after may require him/her to do some
tests/consultations and gives him/her a list of medicines to take. Note that each test is done by a doctor
and different tests could be done by different doctors. The information of the tests/consultations and
medicines is as follows:

No Date Time Code Name Price Discount Result Code Name of Indication
of test of test of Doctor
Doctor
No Code of Name of Unit Quantity Unit Amount Indication Code Name
medicine medicine Price of of
Doctor Doctor

Now, design a database in BCNF suitable for this clinic.

Exercise 3: Give an ERD for the following system.

300 employees of a company are organized into different departments. For each employee, we
have his social security number, name, address, sex, birthdate, phone and email. Each department
has a name, a role and a head (who is also an employee). Note that each employee works for
only one department at a time, but he could change from one department to another department.
Each time he works for a department, the company signs a contract specifying his salary, start
date and end date. Each department handles several projects (each project is handled by only one
department). Each project has a name, start date, end date, a project manager and a number of
employees who work on it. Note that an employee could work on different projects with a
specified number of hours. Each employee may have several dependents. For each dependent,
we keep track of their name, sex, birthdate and relationship to the employee.

Exercise 3: Give an ERD for the following system.

A hardware store sells several home workshop products to the public (such as power saws and
sanders). Each product has several different manufacturers who manufacture it, and prices are
different for products made by different manufacturers. Each time one or more products are sold
to a customer, an invoice is created which lists the date, items purchased and their prices, and
then the total purchase and tax amounts.

You might also like