Course Work 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

NDEJJE UNIVERSITY

DATABASE PROGRAMMING

FACULTY: BASIC SCIENCES AND I.T.

COURSE: BACHELOR IN I.T.

UNIT: DATABASE PROGRAMMING

LECTURER: DATSUN BAZZEKETTA

MEMBERS:

NALWANGA TEDDY BIT 17/2/314/E/772


WALYOMO BENJAMIN BIT 17/2/314/E/715
NABATAMBA BRENDA BIT 17/2//314/E/636
YIGA IAN DIT 17/2/222/E/631

NABIMANYA EUNICE BIT 17/2/314/EJ/037


a) Insertion anomaly

If the user of this table wants to insert a new district, he or she must insert correct details of the
table so as to keep the table consistent.

Also if the user of this table wants to insert a new district but without details about the region or MP
for that district, it may be necessary to enter nulls in those cells of the record. However, MPID could
be the primary key and it violates entity integrity rules to insert null values for primary keys.

Deletion anomaly

If the user of this table decides to delete an MP record such as Conductor, information about the
district which he represents and region where Conductor comes from will be lost.

Modification anomaly

If the user of the table wants to update the region column for MP MP112, he or she must also
update that of MP113. If he does not, the table will become inconsistent.

b) The table below is not normalized.

MPID MNAME DISCTRICTID DISTRICTNAME REGIONNAME REGIONID


MP112 Tony Smith D110 KAMPALA DISTRICT CENTRAL REGION S10
MP113 Fani Ali D112 WAKISO DISTRICT CENTRAL REGION S10
MP114 Helen Pearson D114 MBARARA DISTRICT WESTERN REGION S12
MP115 Andrew Baka D116 BUSHENYI DISTRICT WESTERN REGION S12
MP116 Robin Plevin D118 LIRA DISTRICT EASTERN REGION S14
MP117 Conductor D120 SOROTI DISTRICT EASTERN REGION S14

These are the steps of normalizing the table to 3NF.

1NF

In 1NF, each cell in the table must have a single value. Therefore the MNAME column will be split into
MFNAME and MLNAME columns as shown on the next page.
MPID MFNAME MLNAME DISCTRICTID DISTRICTNAME REGIONNAME REGIONID
MP112 Tony Smith D110 KAMPALA DISTRICT CENTRAL REGION S10
MP113 Fani Ali D112 WAKISO DISTRICT CENTRAL REGION S10
MP114 Helen Pearson D114 MBARARA DISTRICT WESTERN REGION S12
MP115 Andrew Baka D116 BUSHENYI DISTRICT WESTERN REGION S12
MP116 Robin Plevin D118 LIRA DISTRICT EASTERN REGION S14
MP117 Conductor NULL D120 SOROTI DISTRICT EASTERN REGION S14

2NF

In 2NF, the table should be in 1NF and all non-primary key columns should be functionally dependant on
the primary key. In other words the table must have one primary key column.

Looking at our table, it has three columns each of which can become a primary key. Therefore, each
primary key column will go to its own table along with the attributes dependant on it as shown below.

MPDETAILS

MPID MFNAME MLNAME DISCTRICTID


MP112 Tony Smith D110
MP113 Fani Ali D112
MP114 Helen Pearson D114
MP115 Andrew Baka D116
MP116 Robin Plevin D118
MP117 Conductor NULL D120

DISTRICTDETAILS

DISCTRICTID DISTRICTNAME REGIONID


D110 KAMPALA DISTRICT S10
D112 WAKISO DISTRICT S10
D114 MBARARA DISTRICT S12
D116 BUSHENYI DISTRICT S12
D118 LIRA DISTRICT S14
D120 SOROTI DISTRICT S14
REGIONTDETAILS

REGIONNAME REGIONID
CENTRAL REGION S10
WESTERN REGION S12
EASTERN REGION S14

Note that the MPDETAILS table has MPID as the foreign key and DISTRICTDETAILS table has REGIONID
column as a foreign key.

3NF

In 3NF, the table should be in 2NF and should not have transitive dependencies.

Since our three formed tables do not have transitive dependencies, they are already in 3NF.

You might also like