±«Óătv

Validation

An advantage of electronic databases are the validation checks available:

  • presence
  • restricted choice
  • field length
  • range

Presence

A presence check makes the person using the database enter something in this field. They cannot leave it blank. For example, when signing up for a new account on a social media platform, you cannot leave the password field empty.

Restricted choice

Restricted choice cuts down on mistakes by only letting you select an option from a menu or list.

Field length

Field length restricts the number of characters typed. This can cut down on the total data requirements of the table.

A typical length check could be used on a National Insurance number field to only allow up to nine characters. This can also stop people from mistyping their NI number by adding in too many characters.

Range

A range check makes sure data entered is within certain limits. This could be used to make sure the user enters a number ˃=1 and ˂=12 if they were entering their month of birth, or that they enter a number ˃=11 and ˂=16 for the database of school pupils between these ages, as shown in the image below.

Computer displaying a validation error.

Sports centre example

The data dictionary for the sports centre tables is shown below. Some of the attributes in each table make use of validation.

Entity: Surface

AttributeKeyTypeSizeRequiredValidation
Surface IDPKText4YesLength = 4
Surface TypeText
SupplierTextRestricted Choice: Surface4U, We Lay, Council
All WeatherBoolean
Cost per m2Number
AttributeSurface ID
KeyPK
TypeText
Size4
RequiredYes
ValidationLength = 4
AttributeSurface Type
Key
TypeText
Size
Required
Validation
AttributeSupplier
Key
TypeText
Size
Required
ValidationRestricted Choice: Surface4U, We Lay, Council
AttributeAll Weather
Key
TypeBoolean
Size
Required
Validation
AttributeCost per m2
Key
TypeNumber
Size
Required
Validation

Entity: Sports area

AttributeKeyTypeSizeRequiredValidation
Area IDPKText3YesLength = 3
Area nameText20
Surface IDFKText4YesLength = 4, linked to SurfaceID in Type of Surface entity
Hire CostNumberRange >=2 and <=80
ManagerText
AvailableBoolean
AttributeArea ID
KeyPK
TypeText
Size3
RequiredYes
ValidationLength = 3
AttributeArea name
Key
TypeText
Size20
Required
Validation
AttributeSurface ID
KeyFK
TypeText
Size4
RequiredYes
ValidationLength = 4, linked to SurfaceID in Type of Surface entity
AttributeHire Cost
Key
TypeNumber
Size
Required
ValidationRange >=2 and <=80
AttributeManager
Key
TypeText
Size
Required
Validation
AttributeAvailable
Key
TypeBoolean
Size
Required
Validation

The required column of a data dictionary is used to indicate the need for presence check validation. If the word ‘Yes’ appears in this column, the developer will know that they need to include a presence check when creating the table in a database package.