sql server - Best approach to go: one table for each operation or one table for all operations? -


I'm preparing a database for a solution I'm experiencing the following scenario:

  • User can add product This product will be related to a specific operation: "Sale", "Buy", etc.
  • Any other user can mark the product as interested. So, I will have a table to generate those who are interested in something

I am struggling to decide which approach to go.

  1. I can create a table for each operation like "ProductSell", the same for users wishing to "ProductBuy", etc., ("InterestedProductSell", "InterestedProductBuy", etc.)

``

  User ProductSell ProductBuy InterestBuy InterestSell ____________ ___________ __________ ___________ ____________ Eid Eid ProductId (ProductBuy P) productId (ProductSell P) Name Title Title UserId UserId Username UserId UserId Date Date  

`` 2 ''

    I can create a table for all the tasks, with a column called "Operation" I am Same for interested users

  User operation product interest ____________ _________ ___________ __________Id Eid ProductId (ProductBuy or ProductSell P) Name Name (Title UserId User Name UserId Date operation can buy, sell, etc.)  

`` `

You can give me your opinion about these two views, or even a third approach Are not I realized that? Things like display, optimization, maintenance, coding ... this requires more options than my vision.

If this is the case, then I am working with SQL Server.

After

2 approach to having a different column operation looks good

User table

  UID name  

Product table


Comments