Search code examples
mysqlduplicatesredundancy

Database Approach - Redundant data


I have 3 tables:

products (id, name, price, etc)
orders (id, date, payment_method, etc)
shipments (id, order_id, product_id, address, etc)

My question is: It is correct to keep in shipments table product_id? I keep it here to find information about a shipped product without using orders table.


Solution

  • I would suggest:

    products (product_id, name, price, etc)
    orders (order_id, date, payment_method, etc)
    orderitem (orderitem_id, order_id, product_id, ...)
    shipment (shipment_id, order_id, ... )
    

    shipment is kind of redundant - I'd add the address etc into orders...