Computing
Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE

Lesson Video 30

• Watch the Lesson video
Make notes on your notes sheet.
Make notes on your notes sheet.
• Complete the learning activities
Make any notes on your notes sheet.
• Check the Learning outcomes

What do I need to Learn?

 I need to learn how to explain what data validation is.

Key Terms

validation validation checks Verification Type check Format check Length check Presence check Range check Lookup check Check digit

Data Validation - Learning Activities

Database validation is a process where the data entered in the database is checked to make sure that it is correct. The purpose of validation is to make sure that data is logical, rational, complete and within acceptable limits.

There are a range of validation methods like range check, type check etc. (see table in notes for more details)

A range check is probably the simplest validation method to understand. We give the user a range of values that are valid to enter then check they have entered a value in that range.

For example we could ask the user to enter a number between 1 and 10. Our validation routine would then check if the value entered was in that range. If the user entered say the number 11 our code should declare the value 'invalid' and ask the user to enter another value

Range Check – generally used when working with data which contains numbers, currency or date and time.

A range check lets you set appropriate limits:

Boundary Description Validation
Upper limit The maximum value is 10. <=10
Lower limit The minimum value is 1. >=1
A range Number entered must be less than or equal to 10 but greater than or equal to 1. >=1 and <=10

Data Validation in practice

I have coded the simple example above using a function called data validation. Run the code and check that it works.