0984

Database Concepts

Databases · 5 question types

When a field is defined, validation rules can be attached so that bad data is rejected before it ever reaches the table.

Validation typeWhat it checks
Length checkThe number of characters entered (e.g. phone number = 11 digits)
Format checkThe pattern of the input (e.g. a product code must be two letters then five digits)
Range checkThe value is between a minimum and maximum (e.g. age 0-120)
Presence checkThe field is not left blank
Type checkThe value matches the field's data type (e.g. only dates in a date field)
Check digitAn algorithm-derived final digit confirms the rest of the number was entered correctly (topic 5)

Validation at the database level is a safety net: even if the application code forgets to check, the database itself will reject bad data.