Hi all, There are two methods which I noticed while designing child tables
Method 1 Example:
Master Table >>Order Table (order_id pk)
Child Table >>order_products
table (order_id,product_id, quantity,PK (order_id,product_id))
Method 2 example:
Master Table >>Order Table (order_id pk)
Child Table >>order_products table (order_product_id PK, order_id,product_id, quantity)
Question:
Notice that We are using addition order_product_id
in the second method. That is my question, is it goo to use combined primary key or introduce a new column like in method 2?
what are pros and cons.
is the anwer depends on the relationship? (in case of one-to-many
method 1 is better or in case of many-to-many
method 2 is better etc)