A foreign key constraint keeps related tables consistent by requiring values in one column or column set to match existing unique or primary-key values in another table. In an eCommerce database, reviews can reference only existing products and customers. section 2.3.1 section 2.3.2
Rejecting an invalid review
The catalog contains product 4, but not product 1004. Inserting a review with product_id = 1004 fails with a foreign-key violation; using product_id = 4 succeeds when the customer also exists.
Protecting referenced customers
After customer 1 posts a review, deleting that account fails because the account is still referenced by products.reviews. Marking the account as deleted preserves the relationship instead.

















