Relational databases

A relational database has more than one table and the tables are linked using key fields. For example, a library database could have three tables:

  1. Customer - when a customer joins the library a record is created. It stores their details such as their first name and surname and includes a unique Customer ID.
  2. Book - each book in the library has a record. It stores details about the book, such as the author and title and includes a unique book ID.
  3. Lending - when a customer borrows a book, the lending table stores the customer's unique ID and the book's unique ID in a record. The record could also include additional information such as when the book was borrowed and when it's due back.

The customer and book ID are both examples of key fields.


  • The book's details and the customer's details need only be entered into the database once.
  • Because of this, mistakes are less likely to happen and if there were a mistake in a customer's record, for example, correcting it will correct the mistake database-wide.
  • Duplication is avoided - this keeps the database's file size down.
  • Details about books and customers are easily accessible using their unique IDs.
  • Queries can be performed and reports generated, eg a list of books a customer has borrowed since joining the library.
Library computer showing relational database onscreen and character returning a late book