Many clients come to us looking for a database application. But what is a database application exactly, and how does it differ from other applications?
The main feature of a database application is that it is primarily concerned with creating, updating and reporting on data within a database. A database is a piece of software which manages a collection of data. A database can store data on anything, sales orders, staff holidays, your record collection. We could just store all this information in text files, or excel spreadsheets, so why do we use a database instead? ln addition to storing data a database also provides other important services and guarantees about that data.
Databases ensures data integrity. This means for example that if each order in your database links to a piece of data about a product then the database will simply not let you add a new order to the database unless the required product already exists. Similarly it will not let you delete a product that has orders already linking to it. This is just a simple example but databases can also ensure that far more complex relationships between the data always hold true, and because of this it can provide guarantees that overall the data within the database remains in a consistent state.
As well as ensuring that relationships between pieces of data are preserved a database can also ensure that individual pieces of data are properly structured. For example it can ensure that all products have a price, which is a number and is greater than zero. It can also ensure that every product has a stock code, and that every stock code is unique (i.e. no two products have the same stock code). If for example we used a spreadsheet to store product data then as you probably know you can enter any value you want into any cell in a spreadsheet, so no such guarantees are possible.
Finally a database provides a very powerful means of querying the data within the database. This is via specially constructed queries in a language called SQL (Structured Query Language). SQL is a database specific language and it enables us to write very complex queries about the database. The queries can span multiple types of data within the database (i.e. join data from an order table to data from a product table) and can contain very complex conditions (e.g. all orders with a total price greater than zero, unless the order contains a certain product or was placed on a Tuesday). Databases are very good at analysing SQL queries and working out how to run the query very efficiently.
So in summary a database application is all about managing data. The reason we use a database is that it provides a range of tools which guarantee that our data remains well organised and consistent. It also provides tools for querying the data using very powerful and efficient queries. If you have found yourself trying to manage larger and larger quanties of data in places such as text files, word documents or spreadsheets and are finding that the data is becoming difficult to manage, or keep consistent and up to date, then perhaps a database application can help.
We've only touched on the database aspect of a database application here. Most database applications are built in three layers, with the database being the 'lowest' layer. The other two layers are generally the service / business logic layer and the user interface layer. The service layer is where the business specific logic is written, this is the code that actually controls how data is updated within the database, and decides which queries need to be run. The user interface layer is the visual interface into the application. This can be a web site, mobile application or desktop software. We will look a bit more deeply into these other layers in other posts.