Composite Primary Keys

Here’s a good introduction to¬†composite primary keys by Jeff Smith. When you’re defining a database table that’s being used to relate two other tables (e.g., products_discounts to map discounts to particular products), you should always create it with a composite primary key (i.e., both the product_id and discount_id columns) rather than a single identity column (e.g., product_discount_id).

Leave a Reply

Your email address will not be published. Required fields are marked *