Not a premium member yet? Save 100's of hours on lesson prep with a comprehensive library of GCSE Computer Science resources - including worksheets, tests, and PowerPoint presentations.
Download the complete GCSE Computer Science bundle including all teacher resources and student revision:
- 200+ Computer Science/ICT resources
+ any we release in the future!
- Access to all student revision notes
- OCR, AQA, Edexcel and WJEC compatible
- New 9-1 GCSE spec
It is imperative that data is entered correctly in a database. An automated database has the benefit of having automatic checks to prevent incorrect data from being recorded into the database. This is a process not available in a manual database.
Database validation is a process where the data entered in the database is checked to make sure that it is correct. For example, validation can be utilised to check that only Male or Female is entered in a sex field. It cannot check that it is correct data entered.
Validation is a way of trying to lessen the number of errors in the data input.
The validation is carried out by the computer when you input data. It is a way of checking the input data against the set of validation rules.
The purpose of validation is to make sure that data is logical, rational, complete and within acceptable limits.
Database Validation Methods
If you make a specific field numeric then it won’t allow you to input any letters or other non-numeric characters. Be wary when using the numeric data type, if you use it for fields like phone number, it won’t allow you to enter spaces or other forms of formatting.
Some data types can do an extra type check. For example, a date data type will ensure that a date inputted existed or can exist in the future. It would not accept the date 30/02/2018.
This is sometimes called Allow Blank or Mandatory. This type of validation compels the user to enter data in the required field.
For example, in an address book, you can make either the address or phone number optional, while you must make the name required. Leaving a mandatory field blank will trigger an error message that will prevent you from proceeding to the next step.
It is essential that one record can be plainly recognised from another record. Generally, each record has one field that functions as a unique identifier for a record. An easy validation check can be done to make sure that a value occurs only once in this field, doesn’t matter if there are thousands of records in the database.
Range check is a validation check applied to numeric fields. This is to ensure that only numbers within a certain domain can be entered into a field. Remember that this does not necessarily mean that the data entered will be correct. But, it will lie within reasonable limits.
This is used for a field that requires an entry in a specific format. Examples are date format, postal codes and driver’s license numbers.
There are times that fields in a database have a definite amount of data that can be entered into them. For example, days in a week is limited to Sunday, Monday, Tuesday, etc.
Programming a database to accept only one of a series of valid choices can prevent errors and lessen the time it takes to input data.
This has different forms like list box, combo box or radio button.
The benefits of restricted choice are:
- Faster data entry because it is typically much faster to select from a list than to type each individual entry.
- Enhanced accuracy because it lessens the risk of spelling mistakes.
- Limits the options to choose from by only displaying the essential choices.
If you’re using a relational database, then you can impose referential integrity to validate inputs. You can check data inputs in certain fields against values in other tables. For example, in the job database, when a new hire is entered, you could check the supervisor name against the employee table and you can check the department name against the department table.