Question bank › IB Computer Science › A3 Databases

Normalization (1NF–3NF) and denormalization

Answer on paper first, then reveal the mark scheme one mark at a time.

1Stretch6 marks

An unnormalized table stores orders:

ORDERS(OrderID, OrderDate, CustomerID, CustomerName, CustomerCity, {ProductID, ProductName, UnitPrice, Quantity})

The items in braces repeat for each product on the order. Construct a database in third normal form (3NF) from this table. In your answer, identify the problem removed at each stage (1NF, 2NF, 3NF) and give the final relations with primary keys marked (PK) and foreign keys marked (FK). [6]

2Core4 marks

A sports club stores its members in this table:

MemberIDNameSports
M01Ava KerrTennis, Swimming
M02Leo RuizRowing
M03Ana BoseSwimming, Rowing, Tennis

(a) State what is meant by an atomic value in a relational database. [1]

(b) Explain why this table is not in first normal form (1NF). [1]

(c) The table is rewritten as a single table in 1NF with exactly one sport in each row. State the primary key of the new table and the number of rows it will contain. [2]

3Standard4 marks

An exam board stores entries in the relation:

EXAM_ENTRY(CandidateNo, PaperCode, CandidateName, PaperTitle, Mark)

The primary key is the composite key (CandidateNo, PaperCode). All values are atomic.

(a) Identify one partial-key dependency in EXAM_ENTRY. [1]

(b) Explain why EXAM_ENTRY is in first normal form (1NF) but not in second normal form (2NF). [2]

(c) Another relation, CANDIDATE(CandidateNo, CandidateName, DateOfBirth), is in 1NF. Explain why it must also be in 2NF. [1]

Stuck on Normalization (1NF–3NF) and denormalization?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4Standard4 marks

The diagram shows the functional dependencies in the relation STAFF(StaffID, StaffName, DeptCode, DeptName, DeptFloor). An arrow from A to B means "A determines B". StaffID is the primary key.

(a) Identify the transitive dependency shown in the diagram and explain why it means STAFF is not in third normal form (3NF). [2]

(b) Construct a set of relations in 3NF that hold the same data. Show the primary key and any foreign key of each relation. [2]

StaffIDStaffNameDeptCodeDeptNameDeptFloor
5Core4 marks

A music school records every lesson in one table, LESSON. The primary key is LessonID.

LessonIDLessonDateStudentIDStudentNameTeacherIDTeacherNameTeacherExt
L10103 MarS14PriyaT2Mr Okaforext 214
L10203 MarS09TomT3Ms Lundext 220
L10304 MarS22EllisT2Mr Okaforext 214
L10405 MarS14PriyaT2Mr Okaforext 214
L10505 MarS31ZaraT5Mrs Greyext 231
L10606 MarS09TomT3Ms Lundext 220
L10707 MarS22EllisT2Mr Okaforext 214

(a) Teacher T2 moves office and gets a new phone extension. State how many rows must be changed, and explain the problem this causes. [2]

(b) The school hires a new teacher, T8, who has not yet been given any lessons. Describe the problem in adding T8 to this table. [1]

(c) Lesson L105 is cancelled and its row is deleted. Describe the problem this causes. [1]

6Hard6 marks

A veterinary practice stores vaccination records in a single table:

VACCINATION(PetID, VaccineCode, DateGiven, PetName, OwnerID, OwnerName, OwnerPhone, VaccineName, Manufacturer, BatchNo)

The primary key is (PetID, VaccineCode, DateGiven). All values are atomic. The following rules apply:

  • each pet has exactly one owner, but an owner can have several pets;
  • each vaccine code identifies one vaccine name and one manufacturer;
  • the batch number is recorded for each individual injection.

Normalize this table to third normal form (3NF). Explain each dependency you remove, and give the final relations with primary keys (PK) and foreign keys (FK) marked. [6]

7Hard5 marks

A news website stores its data in 3NF:

ARTICLE(ArticleID, Title, Body, PublishDate, AuthorID, SectionID)
AUTHOR(AuthorID, AuthorName, Biography)
SECTION(SectionID, SectionName)

Every time an article page is viewed, the server joins all three tables to display the title, author name and section name. The site has about 2 million page views a day but publishes only about 40 new articles a day, and authors rarely change their names.

The developer proposes denormalizing the database by also storing AuthorName and SectionName in every ARTICLE row.

Evaluate this proposal. [5]

8Standard5 marks

A library’s LOAN table is not normalized. Each of its 24 000 loan records stores the borrower’s name (32 bytes) and address (64 bytes). The loans were made by 1 500 different borrowers.

The table is normalized: each LOAN record now stores only a BorrowerID (3 bytes), and a new BORROWER table stores one record per borrower containing BorrowerID (3 bytes), name (32 bytes) and address (64 bytes).

(a) Calculate the storage, in bytes, used for borrower data in the LOAN table before normalization. [1]

(b) Calculate the total storage, in bytes, used for borrower data after normalization. [2]

(c) Calculate the percentage reduction in storage for borrower data. Give your answer to 1 decimal place. [1]

(d) Apart from saving storage, state one benefit of the normalized design. [1]

9Stretch5 marks

A college timetable is stored in the table below. The designer states that the primary key is (ModuleCode, GroupNo).

ModuleCodeModuleTitleGroupNoTutorRoom
CS210Databases1PatelB12
CS210Databases2NovakB14
CS220Networks1PatelB12
CS230Algorithms1HaleC03
CS230Algorithms2HaleC03

(a) Use the data to show that the functional dependency ModuleCode → Tutor does not hold. [1]

(b) Identify a partial-key dependency that is consistent with the data. [1]

(c) A student notices that each tutor always appears with the same room and concludes that Tutor → Room is a functional dependency. Explain why the data alone cannot prove this. [2]

(d) The college confirms that every tutor teaches in one fixed room. State the highest normal form the table is in, and justify your answer. [1]

10Hard5 marks

A student designs a cinema booking database and claims it is in third normal form (3NF):

FILM(FilmID, Title, Certificate, DurationMins)
SCREEN(ScreenNo, Capacity)
SCREENING(ScreeningID, FilmID, ScreenNo, StartTime, Title)
BOOKING(BookingID, ScreeningID, SeatRef, CustomerEmail, CustomerName)

Each customer is identified by a unique email address.

(a) Identify two relations that are not in 3NF. For each, explain the dependency that breaks 3NF and state how the design should be corrected. [4]

(b) Suggest why a developer might deliberately keep Title in SCREENING. [1]

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session