8. Relational databases

On the previous page, we saw that a flat file database wasn't always the best choice as it causes a lot of data duplication.

The answer to this is called a relational database.

In the database below, the data is split up into sensible groups i.e. customer data, pets data and appointments data. Then a separate table is made for each group.

Customer Table
Pet Table
Appointment Table

Once the tables have been set up, a relationship can be created to link them together - as shown by the lines linking the tables below.

This is known as a 'relational database'.

database relationships

 

The main benefit of a relational database is that data doesn't have to be duplicated. When a customer books an appointment for their pet, a new record is created on the 'appointment's table' and the relevant Customer and Pet IDs are chosen.

Reducing data duplication reduces the amount of data which needs to be stored, thus making the database smaller. It also reduces the risk of mistakes, because every time you have to type the same data in, there is a risk you could mis-spell it.

 

challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Relational Database