Simple flat file databases require a way of storing their data onto a storage device. A table in a database is a collection of fields. Each fields has a data type and a size. Using this information we can work out what the maximum size, in bytes, needed to store a single record of the database. This is known as a fixed length record. Consider the following example.

 

First name

Text

20

Last name

Text

30

Date of birth

Date

6

Height (cm)

Integer

4

Weight (Kg)

Float

4

Eats school lunch`

Boolean

1

 

When we define the sizes it is important to think about what is going to be stored in them and their data type. Integers and real numbers both have a fixed length as does Boolean and dates. Text is variable depending on the maximum number of letters that will be stored. This must be a maximum not a average as otherwise if you had some text larger than the size specified you would have to truncate it (chop the end off).

 

The size of the above record can be easily calculated as

 

Size = 20 + 30 + 6 + 4 + 4 + 1

Size = 65 bytes

 

In order to store a single record onto a hard drive requires 65 bytes of data. To store 10 records would require 650 bytes (65 x 10). Following this to store 342 records would require 22230 bytes (342 x 65).