Databases (HT2014)

Tutorial 2

Functional dependencies and BCNF

This Tutorial uses the same domain as Tutorial 1.

The things that are to be recorded are (I repeat the information here in case you don't have the exercises from the first week):

Classes in a particular course are given at the same day and time each week, possibly more than once each week. Each course is given by one teacher. A teacher can hold several courses, but will only hold classes in the same class room. More than one teacher could have classes in the same class room (though of course not at the same time).

The full relation could thus be given as:

Classes(courseName, teacherName, teacherTitle, roomName, #students, weekday, time, #seats)

Car rental

Here's another domain that you can practise on to do the same thing. A small car rental business wants a database to store information about customers, cars and rentals. The full relation is

RentACar(custNr, custName, custAddress, carType, regNr, rentStart, rentFinish)

Third Normal Form (3NF)

Suppose we have relation R(A,B,C,D,E,F) with functional dependencies AB → C, CD → E, E → B, B → F, E → D, E → F.

State which FDs listed above violate third normal form (3NF).

Decompose relation R to 3NF.

Multivalued Dependecies and 4NF

Let's extend the domain to encompass students. A student is identified by his or her name (assumed to be unique). A student is affiliated with one of the four student houses; Gryffindor, Hufflepuff, Ravenclaw and Slytherin. We also want to store the year that the student started (mini-quiz: Why is this better than to store which year the student is on now, e.g. a 4th-year student?).

Students read courses (we don't care about those who have finished courses, or the grades). Each student can read several courses at the same time, and of course several students can be enrolled in the same course.

Furthermore we add information about course literature. For each course we want to store the books (could be more than one) and their authors.

Classes(courseName, teacherName, teacherTitle, roomName, weekday, time, studentName, studentHouse, studentYear, book, author)

Book exercises

Also do the following exercises from "Database Systems: The Complete Book, 2/E":

If you have the first edition of the textbook, do exercises:


Last Modified: 17 September 2014 by Graham Kemp