Database concepts

Computer Science AS · Databases. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science AS topics

The idea

In a file-based approach each program keeps its own files. The same data is stored many times (redundancy), copies stop matching (inconsistency) and the programs depend on the file structure. A relational database stores each fact once in linked tables.

An entity is a thing we store data about, and it becomes a table. A record (tuple) is a row and a field (attribute) is a column. Tables are linked when the primary key of one table appears as a foreign key in another.

Normalisation organises the tables step by step, from 1NF to 3NF, to remove redundancy.

Rules to remember

Common mistake

When a table has a single-field primary key, students look for a 2NF problem. A partial dependency is only possible with a composite key, so go straight to checking 3NF.

Worked example

LOAN(LoanID, BookID, BookTitle, DateOut) has primary key LoanID. Every field holds one value. Is the table in 3NF? If not, give a 3NF design.

  1. Every field holds one value, so it is in 1NF. The primary key is a single field, so there is no partial dependency and it is in 2NF.
  2. BookTitle depends on BookID, and BookID is not the key. This is a non-key dependency, so the table is not in 3NF.
  3. Move the dependent field to its own table with BookID as the primary key, and keep BookID in LOAN as a foreign key.

Answer: Not in 3NF. Use LOAN(LoanID, BookID, DateOut) and BOOK(BookID, BookTitle).

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← Ethics and ownershipDatabase Management Systems (DBMS) →Take a Computer Science AS test