Create a Database

Database software helps us to store data in a structured and organised way.

Storing Data

When creating a database to store data we must first decide what data we want to store, and then what type of data it is so it can be stored in the correct way.

We already know that when we store data on a computer it must be stored as binary (0s and 1s).

Numbers can be converted from decimal to binary.

Text & characters can be converted (using ASCII) to numbers then binary.

The problem with this is that when storing data in one byte, 000000101 and 00110101 could both be used to store 5.

So the computer needs to know which we are going to use.

Data Types

The common data types we have available to choose from are:

  • Number (real numbers used for counting)
  • Text (letters, characters and numbers)
  • Boolean (True/False or Y/N)
  • Date (actual date you would find on a calendar e.g. 1/07/15)
  • Time (actual time of day e.g 12:45 PM - NOT a period of time!)
  • Currency - Used to store money values.
  • Attachment (a space to store a link to images, documents, etc.)

When we decide what data we want to store we must create a place to store it in our database. This space is called a field.

Each field is used to store one item of data e.g someone's age.

When we create a database we must tell it what data type it is so that the computer can store it in the correct (binary) format.

Rules for field names

  • Names must be descriptive and meaningful
  • Names must not start with a number
  • Don’t use characters (definitely not spaces).
  • Use camelType to indicate multiple words in a name.

How to create a database

L05 - Create a Database.mov

Keywords

Table

A structure used to store data about multiple items of the same type.

Record

A collection of data about one single item. It appears as a row in a table.

Field

A single characteristic of data of a single item. It appears in a table as a column.