Databases : Library Example

A library database is being set up. The database will be created with a relational database package.

Identifying The Files

The database needs to store information about three different things. These are the library's members, books and the loans it has made. The database designer has therefore identified these three files that the system will require :

File Structure

For each of the three files the designer must now decide what information the file should contain. This will include the field names, types and lengths. A primary key must also be identified for each file.

Members File

The members file will store information about each borrower. The primary key field must be Membership Number as it is the only field which will uniquely identify each person. Member Name can not be a key field as two borrowers could have the same name.

Books File

The books file will store information about each book the library owns. The primary key field must be Copy Number which can uniquely identify each copy of each book.

The category of each book, e.g. "History", "Geography", "Science Fiction" will be coded as a three letter code e.g. "HIS" or "GEO" to reduce storage space and speed up data entry.

Loans File

The loans file will store details of who has which books on loan at the moment. When a book is borrowed a record will be created in the loans file which will store the Membership Number of the borrower, the Copy Number of the book and the date the book is due back. Copy Number must be the primary key field. Membership Number can not be a key as a borrower may borrow more than one book at a time.

Relationships

The following relationships exist between the three files :

These relationships can be used to find out information using the data in the database. For example to find out who has the book "100 Facts about Animals" the database software must :

GCSE ICT Companion 04 - (C) P Meakin 2004