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

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

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.