📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store

    • Question

      What is the purpose of using foreign keys in a

      relational database?
      A To uniquely identify a record in a table Correct Answer Incorrect Answer
      B To establish and enforce a link between the data in two tables Correct Answer Incorrect Answer
      C To create indexes for faster data retrieval Correct Answer Incorrect Answer
      D To store temporary data during transactions Correct Answer Incorrect Answer
      E To define data types for columns in a table Correct Answer Incorrect Answer

      Solution

      Foreign keys are a fundamental concept in relational databases, serving to establish a relationship between two tables. A foreign key in one table points to a primary key in another table, thus creating a link between the two. This relationship helps maintain referential integrity, ensuring that relationships between records are consistent. For example, if a "Customer" table has a foreign key that points to a "Country" table, it guarantees that every customer is associated with a valid country record. Option A (To uniquely identify a record in a table) describes the purpose of primary keys, not foreign keys. Option C (To create indexes for faster data retrieval) is misleading; while foreign keys can be indexed, their primary role is to enforce relationships. Option D (To store temporary data during transactions) is incorrect, as foreign keys do not store data; they link data between tables. Option E (To define data types for columns in a table) is unrelated to foreign keys; data types are defined separately in the table schema.

      Practice Next

      Relevant for Exams:

      ask-question