Data validation
From Wikipedia, the free encyclopedia
In computer science, data validation is the process of ensuring that a program operates on clean, correct and useful data. It uses routines that check for correctness or meaningfulness of data that are input to the system.
The simplest data validation verifies that the characters provided come from a valid set. For example, telephone numbers should include the digits and possibly the characters +, -, ( and ) (plus, minus and the parentheses). A more sophisticated data validation routine would check to see the user has entered a valid country code; the number of digits entered matches the convention for the country or area specified, etc.
Incorrect data validation can lead to data corruption or a security vulnerability.
Data validation checks that the data are valid and sensible/reasonable before they are processed.
Methods used for validation are...
- Format or picture check
Checks that the data is in a specified format (template), e.g., dates have to be in the format DD/MM/YYYY.
- Data type checks
Check the data type of the input and give an error message if the input data does not match with the chosen data type, e.g., In an input box accepting numeric data, if the letter 'O' was typed instead of the number zero, an error message would appear.
- Range check
Checks that the data lie within a specified range of values, e.g., the month of a person's date of birth should lie between 1 and 12.
- Limit check
Unlike range checks, data is checked for one limit only, upper OR lower, e.g., data should not be greater than 2 (>2).
- Presence check
Checks that important data are actually present and have not been missed out, e.g., customers may be required to have their telephone numbers listed.
- Check digits
Used for numerical data. An extra digit is added to a number which is calculated from the digits. The computer checks this calculation when data are entered, e.g., The ISBN for a book. The last digit is a check digit calculated using a modulus 11 method.
- Batch totals
Checks for missing records. Numerical fields may be added together for all records in a batch. The batch total is entered and the computer checks that the total is correct, e.g., add the 'Total Cost' field of a number of transactions together.
- Hash totals
This is just a batch total done on one or more numeric fields which appears in every record , e.g., add the Telephone Numbers together for a number of Customers.
- Spelling check
Looks for spelling and grammar errors.
- Consistency Checks
Checks fields to ensure data in these fields corresponds, e.g., If Title = "Mr.", then Gender = "M".