A true relational database must go beyond throwing data into a few tables and writing some SQL statements to pull that data out.
At best a badly designed table structure will slow the execution of queries and could make it impossible for the database to function as intended.
A database table should not be considered as just another table; it has to follow a set of rules to be considered truly relational. Academically it is referred to as a 'relation' to make the distinction.
The five rules of a relational table are:
A table conforming to the five rules:
Id | Name | DOB | Manager |
---|---|---|---|
1 | Fred | 11/02/1971 | 3 |
2 | Fred | 11/02/1971 | 3 |
3 | Sue | 08/07/1975 | 2 |
Id
, Name
, DOB
and Manager
only contain a single value.Id
contains only integers, Name
contains text (we could add that it's text of four characters or less), DOB
contains dates of a valid type and Manager
contains integers (we could add that corresponds to a Primary Key field in a managers table).Id
, Name
, DOB
and Manager
are unique heading names within the table.Id
field ensures that each record is distinct from any other record within the table.A badly designed table:
Id | Name | DOB | Name |
---|---|---|---|
1 | Fred | 11/02/1971 | 3 |
1 | Fred | 11/02/1971 | 3 |
3 | Sue | Friday the 18th July 1975 | 2, 1 |