Tables and...more tables

Relational databases can store more complex data than a simple list, like a spreadsheet or address list.

In a relational database there are multiple tables. Each table stores data about one set of things, customers, orders, invoices, products etc.

Diagram showing two tables in a database, one holding customer details and the other a list of invoices

To link things in different tables, for instance a customer with their invoices, the database matches the values in the two tables - as shown in the diagram above. The database returns the results as another table; the result of combining the data from both tables

Diagram showing how a relational database combines records from both the tables above using
				the customer's reference number

As you can see for a system like this to work each customer must have one unique Reference number otherwise you may not get the right answer! If two customers had the same Reference number you would get both their invoices and if one customer had two References you may only get some of their invoices. This is one of several 'rules' which a relational database uses to ensure that the results you get are reliable and accurate.

The example above shows how two tables work together, but you can add as many tables as you need. This illustration shows just a portion of a possible database but you can see how by building a series of interlinked tables you can store all the data you need.

Diagram illustrating a relational database built up from six interlinked tables