An e-health startup maintains separate relational tables for doctors, patients, and appointments in a PostgreSQL database. Management wants to be certain that each appointment row always references an existing doctor and patient record, preventing orphaned references during inserts, updates, or deletes. Which database design feature should the developer implement to guarantee these valid associations at the database level?
Foreign keys referencing records in other tables
Column partitioning for storing data by column
Denormalization merging data from multiple tables
Primary indexing that organizes data in each table
Foreign keys referencing records in other tables enforce referential integrity, ensuring that each appointment row must correspond to existing doctor and patient rows. Primary indexing organizes data within a single table but does not check cross-table links. Column partitioning improves storage layout rather than relationship integrity. Denormalization merges redundant data and can introduce inconsistencies unless extra safeguards are used.
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 a foreign key in a database?
Open an interactive chat with Bash
How does a foreign key ensure data consistency?
Open an interactive chat with Bash
What are the differences between primary keys and foreign keys?