Databases

A database is a persistent and organised store of data. Imagine a database storing information about customers for Vicki's Vinyl record store:

Customer IDFirst nameLast nameGenderAddressTown/City
C0AliceAndersonF13 Monk WayLisburn
C1BobBuchannonM14b Iris StreetBelfast
C2ConorCrawleyM17 Eblana StreetArmagh
C3DavinaDevlinF53 Fitzwilliam StNewry
C4EdwardEllisonM42 Park ViewEnniskillen

The data has been organised into a table structure with appropriate data types. It is persistent, which means the data will be stored if the computer is turned off or there is power failure.

Flat file and relational databases

The simplest databases store data in a single file, where each record is identified as a new line and each row can be separated by a comma. These are known as flat file databases.

However, flat file databases have several undesirable features:

  1. Data redundancy is created within a database when the same piece of data is held in several places. This leads to records with duplicated data. And data inconsistency.
  2. Data consistency means that a attribute has only one value at a particular time/throughout the database. In a relational database, a change to a data value is implemented throughout the database because it is held in only one table.
  3. Data lacks integrity, i.e. the quality by which information from the system can be trusted. Redundancy and inconsistency show that information can be out of date, can have different values in different parts of the system and can be inaccurate thus reducing data integrity.

Relational databases can be implemented to help reduce (but not remove) data redundancy, which improves data consistency and integrity.

Relational database design attempts to achieve this by modelling data into appropriate entities and creating relations (links) between the entities.