teach-ict.com logo

THE education site for computer science and ICT

3. Range Check

A range check is commonly used when you are working with data which consists of numbers, currency or dates/times.

A range check is a validation rule that sets upper / lower limits to the allowed values for that field.

Here are some examples of types of range check you might use to validate database data.

Boundary Description Validation Rule
Upper limit The maximum price of any item in a shop is £100
<=100
Lower limit In a shop, you cannot sell a negative number of items, however you can sell no items
>=0
A range to achieve a B grade you must score between 75% - 84%

>=75 AND <=84

A date range Must be a valid date  

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