3. Types of Validation

Some of the types of Validation that you could set up are:

Validation Techniques
Validation Example

Type Check
Sometimes you only want data of a certain type entered into a field. 

For example, in a clothes shop, dress sizes may range from 8 to 18.  A number datatype would be a suitable choice for this data.  By setting the datatype as number, only numbers could be entered and you would prevent anyone trying to enter ‘ten’ or ‘ten and a half’.

Some data types can perform an extra type check.  For example, a date data type will ensure that a date you have entered can actually exist e.g. it would not allow you to enter the date 31/02/07.

2, 3, 4


14/05/07

Range Check
A shop may only sell items between the price of £10.00 and £50.00. To stop mistakes being made, a range check can be set up to stop £500.00 being entered by accident.

Another example might be that a social club may not want people below the age of 18 to be able to join.

Notice the use of maths symbols:
> 'greater than'

< 'less than'

= equals

>=10 AND <=50

 

>=18

Presence check
There might be an important piece of data that you want to make sure is always stored.

For example, a school will always want to know an emergency contact number, a video rental store might always want to know a customer's address, a wedding dress shop might always want a record of the brides wedding date.

A presence check makes sure that a critcal field cannot be left blank, it must be filled in.

School database: Emergency contact number

DVLA database: Date test passed

Electoral database: Date of birth

Vet's database: Type of pet

Picture or format check
Some things are always entered in the same format.

Think about postcode, it always has a letter, letter, number, number, number, letter and letter e.g. CV43 9PB. There may be the odd occasion where it differs slightly e.g. a Birmingham postcode B19 8WR, but the letters and numbers are still in the same order.

A picture or format check can be set up to make sure that you can only put letters where letters should be and numbers where numbers should be.

Postcode: CV43 9PB

Telephone number (01926) 615432

Check Digit
This is used when you want to be sure that a range of numbers has been entered correctly for example a barcode or an ISBN number:

ISBN 1 84146 201 2

The check digit is the final number in the sequence, so in this example it is the final ‘2’.

The computer will perform a complex calculation on all of the numbers and then compare the answer to the check digit.  If both match, it means the data was entered correctly. 

ISBN 1 84146 201 2

 

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

Click on this link: Database Validation

 

 

 

 

Copyright © www.teach-ict.com