Question

    In relational databases, which of the following best

    describes the role of a "foreign key"?    
    A A unique identifier for each record in a table Correct Answer Incorrect Answer
    B A key that enforces referential integrity between two tables Correct Answer Incorrect Answer
    C A key that allows duplicate values Correct Answer Incorrect Answer
    D A primary key for another table Correct Answer Incorrect Answer
    E A key that is only used for indexing purposes Correct Answer Incorrect Answer

    Solution

    A foreign key is a column or group of columns in one table that refers to the primary key of another table, thus creating a relationship between the two tables. This key ensures referential integrity , meaning that the data in the foreign key column must match existing data in the primary key column of the referenced table. Referential integrity prevents orphaned records and maintains the consistency of the data across the database. A (Incorrect): This describes a primary key , not a foreign key. C (Incorrect): Foreign keys may allow duplicate values if the relationship permits it, but this is not their defining characteristic. D (Incorrect): While a foreign key references the primary key of another table, it is not itself the primary key of the current table. E (Incorrect): Foreign keys are not used solely for indexing; their main purpose is to enforce relationships between tables.

    Practice Next