A shipping company wants to verify that every new record in a 'Purchases' table references a recognized product code from the 'ProductList' table. They discovered that some entries contain codes never added to 'ProductList.' Which approach BEST validates that each new record references a recognized product code?
Enforce a CHECK constraint to limit the product code field value in the Purchases table
Use an AUTO_INCREMENT constraint on the product code column in the Purchases table to keep them in-sync
Add a FOREIGN KEY constraint on the Purchases table to reference the ProductList table
Insert a default placeholder value using a DEFAULT constraint when the product code is unrecognized
Using a FOREIGN KEY constraint ensures that each product code in the Purchases table matches a valid entry in the ProductList table. Adding placeholders does not validate references. Auto-incrementing IDs do not ensure relationship integrity between tables, while field length restrictions do not enforce referential integrity.
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 constraint?
Open an interactive chat with Bash
How does a FOREIGN KEY constraint improve data integrity?
Open an interactive chat with Bash
What happens if I try to add a record with an unrecognized product code with a FOREIGN KEY constraint?