Reputation: 9
Dear anyone can help me as i have two tables named as Order and Products which have more than two multiple same fields i want to make relationship among all same fields in both tables You can see tables in pictures below:
Upvotes: -3
Views: 762
Reputation: 7260
This is quite simple, assuming product_id
is a key for items.
Make the column Order.product_id
be a FOREIGN KEY
to Product.product_id
.
Drop all other columns that exist in Products
from the table Order
.
Note inspired by comment from @WEI_DBA: price
and quantity
are not really characteristics of product
, but of order
. These should remain in the Order
table and be removed from the Product
table instead. Generally, give each table the data which depend on that table's primary key.
Upvotes: 0