Database
From Simple English Wikipedia, the free encyclopedia
A Database is a program for a computer. It is used to store data. There are different kinds of databases. The most common ones are called relational databases. They store relations of things. For this they use database tables. A very simple example of a database would be an electronic address book.
[edit] Database model
There are different ways how to represent the data.
- Simple files (called flat files): Simply write the data into a number of big files.
- Hierarchical model: The data is organised like a tree structure. The interesting data is at the leaves of the tree
- Network model: Use records and sets to store the data
- Relational model: This uses set theory and predicate logic. It is very widely used. Data looks like it is organised in tables. These tables can then be joined together so that simple fields can be chosen from them.
- Object relational model: This uses the same data types for the database, as for the (object-oriented) application.
[edit] Things a database should be able to do
Any database should be able to do the following (known as ACID)
- All. Either all tasks of a given set (called transaction) are done, or none of them is. Known as Atomicity
- Complete. The data in the database always makes sense. There is no half-done (invalid) data. Known as consistancy
- Isolation. If many people work on the same data, they will not see (or impact) each other. Each of them has their own view of the database, which is independent of the others
- Done. Transactions must be committed, when they are done. Once the commit has been done, they can no longer be undone. Known as durability.
[edit] Ways to organise the data
Like in real life, the same data can be looked at from different perspectives, and it can be organised in different ways. There are different things to consider, when organising the data:
- Each item of data should be stored as few times as possible. Imagine that an unmarried woman wrote a book. Once she marries, her name will change. If her name is only stored once, updating is easy, if it is stored several times it becomes harder. Also, if the data is stored several times, it may contradict itself.
- There is a lot of data., that will take up a lot of space. If things are repeated over and over again, even more space will be taken. This will make finding things slower.
Based on these criteria, a method called Database normalisation was developed. Currently there are 5 Normal forms. These are a way to make a database faster, and make the data take less space.