What is referential integrity?

Get ready for the GMetrix Data Modeling Test. Enhance your skills with flashcards and multiple choice questions, complete with hints and explanations. Prepare effectively for success!

Multiple Choice

What is referential integrity?

Explanation:
Referential integrity ensures that relationships between tables stay consistent by enforcing that a foreign key value must correspond to a valid value in the related table’s primary key, or be NULL if the relationship allows it. This keeps data linked correctly and prevents references to non-existent records. For example, an orders row with a customer_id must refer to an existing customer in the customers table, so the customer_id must match an existing customers.id value (or be NULL if the design allows that). The other statements describe different database ideas: one talks about limiting how many columns a table can have, another about attributes being derived, and the last about every table having a primary key—none of which describe referential integrity.

Referential integrity ensures that relationships between tables stay consistent by enforcing that a foreign key value must correspond to a valid value in the related table’s primary key, or be NULL if the relationship allows it. This keeps data linked correctly and prevents references to non-existent records. For example, an orders row with a customer_id must refer to an existing customer in the customers table, so the customer_id must match an existing customers.id value (or be NULL if the design allows that). The other statements describe different database ideas: one talks about limiting how many columns a table can have, another about attributes being derived, and the last about every table having a primary key—none of which describe referential integrity.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy