Which constraint enforces referential integrity by linking a column to a primary key in another table?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which constraint enforces referential integrity by linking a column to a primary key in another table?

Explanation:
Referential integrity means keeping the relationships between tables consistent. The mechanism that enforces a link from a column in one table to the primary key in another table is the foreign key constraint. It ensures that any value appearing in the child table’s column must exist in the parent table’s primary key (or be allowed as NULL if permitted). This prevents orphaned references and maintains valid relationships across tables. You can also specify actions for delete or update, such as cascading changes or preventing the operation. Other constraints don’t establish cross-table links: a primary key constraint ensures unique, non-null identifiers within a single table; a unique constraint enforces uniqueness within a table; a check constraint enforces a condition on data in a table. So the connector that enforces referential integrity by linking to a primary key in another table is the foreign key constraint.

Referential integrity means keeping the relationships between tables consistent. The mechanism that enforces a link from a column in one table to the primary key in another table is the foreign key constraint. It ensures that any value appearing in the child table’s column must exist in the parent table’s primary key (or be allowed as NULL if permitted). This prevents orphaned references and maintains valid relationships across tables. You can also specify actions for delete or update, such as cascading changes or preventing the operation. Other constraints don’t establish cross-table links: a primary key constraint ensures unique, non-null identifiers within a single table; a unique constraint enforces uniqueness within a table; a check constraint enforces a condition on data in a table. So the connector that enforces referential integrity by linking to a primary key in another table is the foreign key constraint.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy