Professional Documents
Culture Documents
Course Work 1
Course Work 1
Course Work 1
DATABASE PROGRAMMING
MEMBERS:
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.
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
DISTRICTDETAILS
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.