Databases
A databaseA structured set of data held in a computer which makes it easy to search, select and store information is a persistent and organised store of data. Imagine a database storing information about customers for Vicki's Vinyl record store:
Customer ID | First name | Last name | Gender | Address | Town/City |
C0 | Alice | Anderson | F | 13 Monk Way | Lisburn |
C1 | Bob | Buchannon | M | 14b Iris Street | Belfast |
C2 | Conor | Crawley | M | 17 Eblana Street | Armagh |
C3 | Davina | Devlin | F | 53 Fitzwilliam St | Newry |
C4 | Edward | Ellison | M | 42 Park View | Enniskillen |
Customer ID | C0 |
---|---|
First name | Alice |
Last name | Anderson |
Gender | F |
Address | 13 Monk Way |
Town/City | Lisburn |
Customer ID | C1 |
---|---|
First name | Bob |
Last name | Buchannon |
Gender | M |
Address | 14b Iris Street |
Town/City | Belfast |
Customer ID | C2 |
---|---|
First name | Conor |
Last name | Crawley |
Gender | M |
Address | 17 Eblana Street |
Town/City | Armagh |
Customer ID | C3 |
---|---|
First name | Davina |
Last name | Devlin |
Gender | F |
Address | 53 Fitzwilliam St |
Town/City | Newry |
Customer ID | C4 |
---|---|
First name | Edward |
Last name | Ellison |
Gender | M |
Address | 42 Park View |
Town/City | Enniskillen |
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 databaseA structured set of data held in a computer which makes it easy to search, select and store information 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:
- 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 inconsistencyAn irregularity in data or information.
- Data consistency means that a attributeA database component such as a name, location etc. has only one value at a particular time/throughout the database. In a relationHow data or information is connected or linked database, a change to a data value is implemented throughout the database because it is held in only one table.
- Data lacks integrityRefers to the validity of a database. The integrity can be damaged by changes to the structure or software bugs., 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.