100% found this document useful (1 vote)
347 views9 pages

Lab 2 FD Part 1: Exercise 1. You Have Been Given A Form Which Shows The Details of Technical Jobs Carried Out

The document describes a form containing technical job details for staff members at a college, including the staff member, department, job, date, school, and hours worked. To better manage this information, the college wants to create a relational database. The task is to normalize the database to third normal form (3NF) by determining functional dependencies, splitting attributes, and placing attributes into separate tables to remove non-key dependencies and achieve full normalization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
347 views9 pages

Lab 2 FD Part 1: Exercise 1. You Have Been Given A Form Which Shows The Details of Technical Jobs Carried Out

The document describes a form containing technical job details for staff members at a college, including the staff member, department, job, date, school, and hours worked. To better manage this information, the college wants to create a relational database. The task is to normalize the database to third normal form (3NF) by determining functional dependencies, splitting attributes, and placing attributes into separate tables to remove non-key dependencies and achieve full normalization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

Lab 2 FD Part 1

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.

Your task is making the database to 3NF (specify step by step: determine FDs, normalization,..).

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. Based on the form below, design a database suitable for storing information.
(Name of counseling center)

(Code: ….)

Consultation registers list

From …../…../…… To ……/……./………

Result
Test
Name of Registrant

Sex

Name of counselor

Code of counselor
Code of Registrant

Registration time

Referral Service
Start time of
consultation

Negative
Positive
Female
Male
Date

Age

Yes
No

No
                               

                               

                               

                               

                               

                               

Code of referral services:


0 – Not 1 – Care and 2 – ST1 care 3 – TB care 4 – Prevention of
recommend treatment mother-to-child
infection
5 – Family 6 – Other 7 – Support 8 - Detoxification
planning medical care groups
Answer
EX1:
Determine FDs :
TechNo -> TechName, DepId

DepId -> Department

SchoolID -> School

JobNo -> Date, SchoolID

TechNo, JobNo -> Houseworked

->>> Primary key (TechNo, JobNo)

Chuẩn hóa cơ sở dữ liệu thành 1NF :

Các trường thuộc tính phải là nguyên tố, không được chứa giá trị phức:

Trường TechName đang chứa giá trị phức -> chưa đạt chuẩn 1NF

->> chia TechName thành FirstName và LastName

Functional dependency:

TechNo FirstName LastName DeptId Department JobNo Date SchoolID School Hoursworked

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

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

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


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

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

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

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

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

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

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

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

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

Chuẩn hóa cơ sở dữ liệu thành 2NF:

Các trường thuộc tính không phải khóa chính, phải phụ thuộc hoàn toàn vào khóa chính. Không được
phép phụ thuộc 1 phần của khóa chính.

R1: {TechNo}+ = (TechNo, FirstName, LastName, DepId, Department)

Functional dependency:

TechNo -> FirstName, LastName, DepId, Department

TechNo FirstName LastName DepId Department

298 Ian Walls 1 Engineering

345 Alan Smith 2 Helpdesk

380 Bob Jackson 3 Labs

300 Joe Jones 2 Helpdesk


320 Jill Young 3 Labs

R2: {JobNo}+ = (JobNo, Date, SchoolID, School)

Functional dependency:

JobNo-> Date, SchoolID, School

JobNo Date SchoolID School

1002 12/9/07 192 Beauty

1003 12/9/07 125 Computing

3440 18/9/07 346 Bus & Man

1480 15/9/07 192 Beauty

3670 19/9/07 560 Design

1450 15/9/07 125 Computing

R3: Các thuộc tính còn lại + Khóa của R1 + Khóa của R2 = (Houseworked, TechNo, JobNo)

Functional dependency:

TechNo, JobNo, SchoolID -> Houseworked

TechNo JobNo SchoolID Houseworked

298 1002 192 2.5

298 1003 125 5.5

345 1002 192 3

345 3440 346 1.5

345 1480 192 3


380 3670 560 4

380 3440 346 2

300 1450 125 1

300 1480 192 3

320 3440 346 4

320 1002 192 2.5

320 3670 560 2

Chuẩn hóa cơ sở dữ liệu thành 3NF :

Các trường thuộc tính không phải khóa chính, phải phụ thuộc trực tiếp vào khóa chính. Không được
phép phụ thuộc bắc cầu thông qua thuộc tính khác.

R1: (TechNo, FirstName, LastName, DepId, Department)

DepId -> Department ==> Vi phạm 3NF

Tách thành R1a: {DepId}+ =(DepId, Department):

Functional dependency:

DepId -> Department

DepId Department

1 Engineering

2 Helpdesk

3 Labs

Bảng R1b= Các thuộc tính còn lại + Khóa của bảng R1a = (TechNo, FirstName, LastName, DepId)
Functional dependency:

TechNo -> FirstName, LastName, DepId

TechNo FirstName LastName DepId

298 Ian Walls 1

345 Alan Smith 2

380 Bob Jackson 3

300 Joe Jones 2

320 Jill Young 3

R2: (JobNo, Date, SchoolID, School)

SchoolID -> School -> Vi phạm 3NF

Tách thành R2a: {SchoolID}+ = (SchoolID)

Functional dependency:

SchoolID -> School

SchoolID School

192 Beauty

125 Computing

346 Bus & Man

560 Design

Bảng R2b: Các thuộc tính còn lại + Khóa của R2a = (JobNo, Date, SchoolID)

Functional dependency:
JobNo -> Date, SchoolID

JobNo Date SchoolID

1002 12/9/07 192

1003 12/9/07 125

3440 18/9/07 346

1480 15/9/07 192

3670 19/9/07 560

1450 15/9/07 125

R3: Các thuộc tính còn lại + Khóa của R1b + Khóa của R2b = (Houseworked, TechNo, JobNo)

Functional dependency:

TechNo, JobNo -> Houseworked

TechNo JobNo Houseworked

298 1002 2.5

298 1003 5.5

345 1002 3

345 3440 1.5

345 1480 3

380 3670 4

380 3440 2

300 1450 1

300 1480 3

320 3440 4
320 1002 2.5

320 3670 2

EX2:
Tables:
R1(No, Date, Code of Registrant)

R2(Code of Registrant, Name of Registrant, Registration time, Age, Sex, Code of counselor, test, Code of
test)

R3(Code of counselor, Start time of consultation, Name of counselor)

R4(Code of Test, Name of test, Code of Doctor, price, Result)

R5(Code of Doctor, Name of Doctor)

R6(Result, Referral Service)

R7(Referral Service, Place, Medicine)

R8(Medicine, quantity, price, amount)

You might also like