Why use a database?
Databases are useful in many different scenarios for storing data. It is typical to use a database when different sets of data needs to be linked together, such as:
- Pupils in a school and their grades
- Customer records and sales information
- Patients’ and doctors’ records
- Transactions between different bank accounts
- Taxpayers and income tax payments
The three main advantages that databases have over other, simpler data storage systems (such as text files and spreadsheets) are access, integrity, and security.
Access is about making data available to users.
Databases support good data access because:
- Large volumes of data can be stored in one place
- Multiple users can read and modify the data at the same time
- Databases are searchable and sortable, so the data you need can be found quick and easily
- The data structure is extendable and can be modified as requirements change
Databases can ensure that the data contained within them is correct, or has integrity.
To ensure the integrity of a database, each change or transaction must conform to a set of rules known as ACID:
- Atomicity: when changing data within a database, if any part of the change fails, the whole change will fail and the data will remain as it was before the change was made; this prevents partial records being created
- Consistency: before data can be changed in a database, it must be validated against a set of rules
- Isolation: databases allow multiple changes at the same time, but each change is isolated from others
- Durability: once a change has been made, the data is safe, even in the event of system failure
In addition, databases will have mechanisms for backup, distribution, and redundancy, to ensure data is not lost.
While access to text files or spreadsheets can be secured, once someone has access to a file, they have access to all data within that file. Databases can be made very secure, and that includes the ability to have access rights to specific parts of the database and not others.
Databases allow access to be controlled, allowing users to have different privileges: for example, some users may be able to read data, but not to write it.
Data can also be segmented so that users can access only certain parts: for example, a user may be able to read an employee’s name and address but not their salary information.
What other uses for a database can you think of? Share your thoughts in the comments.
In the next step, you will explore an example relational database and look at the data contained within it.
Consider the statements below and add your answers to the comments section.
- What databases have you used in everyday life?
- How did these databases ensure their integrity?