Describe and use methods of data validation

6.2 Data Integrity

What is Data Integrity?

Data integrity means that the data stored in a system is accurate, consistent, and reliable. Think of it like a lockbox that keeps your secrets safe – if the lockbox is broken, the secrets can be lost or corrupted.

Common Causes of Data Loss

  • Human error – typing the wrong value.
  • Hardware failure – a bad hard drive.
  • Software bugs – a program that writes wrong data.
  • Security breaches – malicious actors tampering with data.

Methods of Data Validation

  1. Input Validation – Check that the data entered by a user matches the expected type.

    Example: A phone number must contain only digits and be 10 digits long.

  2. Format Validation – Ensure the data follows a specific pattern.

    Example: An email address must contain @ and a domain.

  3. Range Validation – Confirm that numeric values lie within a valid interval.

    Example: age must satisfy $0 \leq \text{age} \leq 120$.

  4. Consistency Checks – Verify that related data fields agree with each other.

    Example: The startDate must be before the endDate.

  5. Referential Integrity – Ensure that relationships between tables are maintained.

    Example: A student_id in the grades table must exist in the students table.

Practical Example – Validation Table

Field Validation Rule Error Message
Username Alphanumeric, 5–15 characters Username must be 5–15 alphanumeric characters.
Password At least 8 characters, includes a number Password must be 8+ characters and contain a number.
Email Must contain @ and a domain Please enter a valid email address.

Exam Tips 📚

Remember:

  • Define each validation method clearly.
  • Use examples that show the rule and the error message.
  • Explain why each rule protects data integrity.
  • Show a simple diagram or table to summarise rules.

Good luck! 🚀

Revision

Log in to practice.

2 views 0 suggestions