Search code examples
mysqlsqldatabase-normalization

SQL Exam Normalisation issue


Current studying towards a software engineering degree. One of the main topics I study under this umbrella is databases. I just sat my mock exam for this module and I came up across this question about normalising a database to 3NF.

The reason I ask this question is the marking for the mock exam states that the final total number of tables after normalisation is 5. However I got 4 and i'm curious where I went wrong

Image of the un-normalised data to be normalised

The final tables i got are listed as below

Batch_id, Agent_id, Agent_name

batch_id, holiday_code

holiday_code, airport_id, price, quantity

airport_id, airport


Solution

  • When I write it down, I come up with the following tables:

    Agent: agent_id, name
    Holiday: holiday_code, price, airport_id
    Airport: airport_id, airport_name
    Batch: batch_id, agent_id
    BatchLine: batch_id, holiday_code, quantity
    

    Your answer:

    Batch_id, Agent_id, Agent_name

    Agent_id, agent_name, otherwise you would repeat agent_name in your first table – Joakim Danielson

    holiday_code, airport_id, price, quantity

    Won't match up for code B563 (different quantities)