Two kinds of products and one order table

Posted on

Question :

I have the following tables: tblCustomer, tblProductA and tblProductB. I have also an order table
tblOrder. Each order consists of a customer and one or more products from tblProductA and one or more products tblProductB.

The standard case is when we have only one table for products, and we usually use a join table to connect orders and products.

However, in the case I am bringing, it is mandatory to have two tables for products (tblProductA and tblProductB). How do I model this case?

Answer :

There are 2 options:

  1. If your productType has same attribute:
    Multiple Product with same attribute

  2. If your ProductType has different attribute:
    Multiple Product with different attribute. The ProductID in ProductA and ProductB is have one-to-one relation to Product at coloumn ID

Leave a Reply

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