Data Types Worksheet 3 Relational Databases and Normalisation
Data Types Worksheet 3 Relational Databases and Normalisation
2. A car dealer has several different branches which each sell cars, and a database is being
designed to hold data about the cars they sell and the salespeople who sell them.
● Each branch is identified by town. There is a maximum of one branch in each town
● Each salesperson is identified by their SalesID. The number of each model of car that
they sell (SalesVol) is recorded
A first attempt at designing a table to hold the data has been made. The table, called
CarSales, is shown below with some sample data.
1
Worksheet 3 Normalisation
Unit 4 Exchanging data
1. This table does contain list values in rows, which breaks the law of first normal form.
(b) The data is split into two tables. Show the contents of the two tables
Table: SalesPerson
Table: ProductSales
(c) A relationship between the tables has been implemented. Explain how this has been
done.
1. Now each cell contains single values, now, it follows 1NF
(d) Explain why the ProductSales table is not in Third Normal Form (3NF)
Manufacturer depends on Model, not on the primary key (SalesID, Model).
This is a transitive dependency, as the relationship between Model and Manufacturer is
independent of SalesID.
2
Worksheet 3 Normalisation
Unit 4 Exchanging data
(e) Draw an entity relationship diagram to show the entitities in the database in 3NF.
(f) Write the table definitions for the database in 3NF. Use the notation
Tablename (keyfield, Attribute1, Attribute2, …)
SalesPerson:
SalesPerson(SalesID (PK), Name, Branch)
ProductSales:
ProductSales(SalesID (FK), Model (PK), SalesVol)
Manufacturer:
Manufacturer(Model (PK), ManufacturerName)
3
Worksheet 3 Normalisation
Unit 4 Exchanging data