In a relational database designed for a healthcare clinic, there are two tables: "Patients" and "Appointments." The "Patients" table has a "PatientID" field that uniquely identifies each patient. How should this field be properly used in the "Appointments" table to maintain a relationship between the two tables?
Copy all patient information into the "Appointments" table for each appointment
Create a new "AppointmentID" field in the "Patients" table
Generate a random unique identifier for each appointment separately from "PatientID"
Include "PatientID" as a foreign key in the "Appointments" table
In a relational database, a primary key uniquely identifies each record in its own table. To relate those records to another table, that primary key is stored in the other table as a foreign key. Adding the "PatientID" field to the "Appointments" table as a foreign key enforces referential integrity, ensuring that every appointment is linked to an existing patient. The other choices either duplicate data, add unnecessary fields, or fail to create this required link.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between a primary key and a foreign key in a database?
Open an interactive chat with Bash
What is referential integrity in databases?
Open an interactive chat with Bash
Why is data duplication not recommended in relational databases?