How does a relational database ensure data integrity?

2024

How does a relational database ensure data integrity?

  1. A.

    By encrypting all data stored

  2. B.

    By enforcing rules defined in the schema

  3. C.

    By compressing data for efficient storage

  4. D.

    By allowing unrestricted access to all users

Attempted by 1848 students.

Show answer & explanation

Correct answer: B

How a relational database ensures data integrity:

  • Schema constraints: data types, NOT NULL, UNIQUE, PRIMARY KEY, and CHECK constraints ensure stored values meet required rules.

  • Referential integrity: FOREIGN KEY constraints keep relationships consistent so linked rows cannot be left dangling or invalid.

  • Transactions and ACID properties: atomicity, consistency, isolation, and durability ensure changes are applied reliably and leave the database in a consistent state.

  • Triggers and stored procedures: enforce business rules and validate or adjust data when changes occur.

  • Access controls: user privileges and role-based permissions prevent unauthorized modifications that could corrupt data.

Examples:

  • A PRIMARY KEY prevents duplicate rows; a UNIQUE constraint prevents duplicate values in a column.

  • A FOREIGN KEY prevents deleting a parent row while child rows still reference it, preserving referential integrity.

  • A transaction groups multiple updates so either all succeed or none do, avoiding partial updates that could leave data inconsistent.

Why the other statements are incorrect:

  • "By encrypting all data stored" addresses confidentiality and access protection, not the enforcement of correct values or relationships.

  • "By compressing data for efficient storage" improves storage use and possibly performance but does not validate or enforce correctness of data.

  • "By allowing unrestricted access to all users" would increase the risk of incorrect or malicious changes and therefore undermine integrity; access controls are required.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor