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?
Add a FOREIGN KEY constraint on the Purchases table to reference the ProductList table
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
Insert a default placeholder value using a DEFAULT constraint when the product code is unrecognized
Using a FOREIGN KEY constraint is the standard method to ensure that each product code in the Purchases table matches a valid entry in the ProductList table, thereby enforcing referential integrity. A DEFAULT constraint only provides a placeholder value and does not validate the entry against another table. An AUTO_INCREMENT constraint generates new unique numbers and does not link to existing product codes. A CHECK constraint limits the values in a column based on a logical condition but is not designed to enforce relationships by referencing another table.
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 does a FOREIGN KEY constraint do?
Open an interactive chat with Bash
How does a FOREIGN KEY differ from a CHECK constraint?
Open an interactive chat with Bash
What happens if you try to insert a record that violates the FOREIGN KEY constraint?