I am developing a stock ordering system in PHP/MySQL. Products can have multiple suppliers. Products are added to the basket by specifying the quantity required and the supplier. This is the current DB Structure:
Products
=========
id (PK)
name
etc...
Suppliers
==========
id (PK)
name
etc...
Product_Suppliers
=================
id (PK)
product_id (PK)
supplier_id (PK)
price
Basket
=======
product_id (PK)
quantity
product_suppliers_id
The Product_Suppliers table stores the different suppliers and their prices for each product.
When adding a product to the basket, it first checks to see if the product_id already exists in the Basket table - if it does then it will simply overwrite the record. If it does not exist then it will create a new record.
The product_suppliers_id field in the Basket table specifies which supplier has been selected for that particular product.
I wanted to know whether I have got the correct approach here, or whether I need to make any changes to eliminate any redundancy.
