5. Data Types

When you are about to set up a database, you need to think about the 'data type' which you will use for each field.

The most common data types are:

Data Types
Data Type Examples

Alphanumeric or Text

This allows you to type in text, numbers and symbols

Forename: James

Surname: Smith

Address: 73, High Street

Postcode: CV34 5TR

Car Registration: EP06 5TV

Telephone Number: 01926 123456*

 

Number

This allows a whole number or a decimal number

Only numbers can be entered, no letters or symbols

15

21.35

Currency

This automatically formats the data to have a £ or $ or Euro symbol in front of the data and also ensures there are two decimal places.

£5.75

$54.99

Date/Time

This restricts data entry to 1-31 for day (28 or 30 in appropriate months) and 1-12 for month.

It checks that a date can actually exist, for example, it would not allow 31/02/06 to be entered.

It formats the data into long, medium or short date/time

Long Date: 20 February 2006

Medium Date: 20-Feb-06

Short Date: 20/02/06

Long Time: 18:21:35

Medium Time: 06:21 PM

Short Time: 18:21

Autonumber

This datatype will automatically increase by 1 as records are added to the database

Record 1: 1

Record 2: 2

Record 3: 3

Logical, Boolean, Yes/No

This datatype is often referred to as different things, you may hear it called 'logical', or 'boolean' or 'yes/no'.

All it means is that the data is restricted to one of only two choices

Yes/No

Male/Female

Hot/Cold

On/Off

* You would think that 'telephone number' should be a 'number' data type. However all telephone numbers start with a 0 and you can't put a 0 in front of a 'number' datatype, so telephone number needs to be set as a 'text' datatype.

 

Here is a database table with the different data types set up for you to see:

data types

 

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Boolean Data