Topics / Databases / Database Validation

Database Validation

Validation is an automatic check to ensure that the data entered is sensible and feasible.

Validation cannot ensure data is actually accurate.

Database Management Systems allow for some handy validation methods to be implemented.

These are needed because it is easier to try and prevent users from entering garbage than attempting to fix mistakes later.

Validation methods for databases

Range Check

A range check ensures that data is between an upper and lower acceptable value, within a certain range.

Range checks are useful for dates, not just numbers.

E.g. we could check that a date of birth puts a customer within an acceptable age range.

E.g. we could ensure that the quantity of a product ordered is realistic, e.g. give a warning before an order for 100 is accepted when most people only buy 10 or less.

Type Check

A type check ensures that the data entered is of an expected type, e.g. a number or date.

The data needs to be the right type in order to allow processing later on.

Length Check

A length check ensures that the number of characters meets expectations, e.g. 8 character password.

Format Check

A format check ensures the data follows a set pattern (using an input mask).

E.g. UK postcodes follow a particular sequence of letters and numbers.

A format check can ensure that the postcode is at least realistic, hopefully reducing any processing errors later on.

Drop Down Box

A drop down box ensures the user can only choose a predefined option from a list, reducing the chances of spelling mistakes or unwanted responses.

Spelling mistakes would cause problems whilst performing searches on the data, with some records being accidentally missed out of the results.

Allowing people to enter endless options for certain responses could make the data unworkable in some situations.

Drop down boxes and lists are an easy way to help reduce these issues, but are obviously not suited to all types of questions.

Presence Check

A presence check ensures the user has at least entered something into the field, stopping them from accidentally leaving it empty.

E.g. it would be a nightmare if the user left their contact details blank, as how could you get in touch as rectify this mistake later on?

Topics / Databases / Database Validation

Popular Downloads