Databases are everywhere but you never see
them. They are hidden behind the tools and services that you use everyday. Ever wondered
where Facebook, Tumbler and Twitter put their data? Yeah, it’s all stored in a database.
Where do Google store the details of pages that they index from the Internet? Yep, in
a database. Where are the contacts in your mobile phone stored? In a database! Databases do most of the work in the information
systems that we use every day. So what is a database? Is it just a random collection
of stuff all squeezed in together? No, databases are organised, databases have a structure
and all the data we store in them fits into this structure. Very simple databases are called flat-file
databases. They store data in columns of fields and rows of records. Let’s think about a simple database that
Bob uses to store his address book. This database contains the names, addresses, birthdays and
telephone numbers of his friends and family. Bob has met his friend Megan would like to
add her to his address book. He writes down her firstname, lastname, address, post code,
date of birth (so he can remember to send her a birthday card) and her telephone number.
The details that Bob writes down are stored in fields in his address book database. These
are the columns in his database file. The information about Megan fills a whole row
in his database file. Each row is called a record and each of the rows holds information
about a different person in his address book. Unlike a paper address book Bob can carry
out operations on his stored database. He can search it to find a particular person.
Hey, let’s look for Megan. If we search the whole address book for “Megan” then
we might be surprised at what we get back. Bob can make the search more accurate by selecting
the field he wants. So, he can ask the database to return all the records where firstname
equals “Megan”. Or he could ask the database to show everyone with a birthday in December. He can sort the database to show the records
in a different order. He can sort them by Lastname Ascending or by Lastname Descending
or use any other field. These columns of fields can store different
types of data. Let’s have a look at a new and improved version of Bob’s address book.
This view of the database shows just one record. The one about Megan that we looked at earlier,
but Bob has now added a photo of Megan, her age, the time he last called her and how many
times he has called her in the past. The firstname, lastname, address, post code
and telephone number fields all store TEXT. Text fields can hold a mixture of letters,
numbers and symbols. The “date of birth” field has a field
type of DATE so it stores calendar dates. The “Last Call” field is a TIME type which
means it stores its data in time format such as am/pm, or the 24 hour clock. The “photo” field stores data of type
GRAPHIC. This can be any type of image. The AGE field is a special field. There isn’t
any data in it, instead it contains a special calculation to work out Megan’s age based
on her date of birthday and the date today. This calculation is called a formula and fields
like this have a field type of CALCULATED. The “Times Called” field contains data
of type NUMBER – this can be whole numbers or decimals. Some things to remember:
Flat-file databases are simple stores of information. These simple databases have fields as columns,
records as rows and are stored in files. Fields can have six different types: text,
number, date, time, graphics and calculated. A database can be searched to find specific
records and a database can be sorted into any order based on its fields.