how to setup this diagram? (multiple selling methods)

夙愿已清 提交于 2020-06-01 07:38:20

问题


I'm supposed to create a sort of second brand website. When someone wants to sell a product, he has the option to sell it for:

  • a set amount
  • free
  • to bid

can anyone give me an assist on how to continue? This is what i have so far, but i'm stuck and don't know how to continue. (sorry for the use of native language, the entities are : member, seller (top one) buyer (bottom one) and products, in that order.

any form of help is appreciated!


回答1:


I really don’t know where your problem is but I would consider:

1) if buyers and sellers share the same kind of information then I would make just one table for users, to store them both. That way you have a unique user_id.

2) have a products table like yours, indicating the seller_id (foreign key to users table) and a field to indicate if it’s a direct sale or product for bidding.

3) have a table for storing bids, indicating the product_id, buyer_id (foreign key to users table) and bid details: amount, date, etc.

4) have a table for purchases, and use it for two goals:
4.1) for storing direct sales of products.
4.2) for storing the sale made on the final bid performed on a product for bidding.
I would store the product_id, buyer_id, amount paid, date, and perhaps even an optional reference to a bid_id.

That way you can simplify and have the same kind of information in a simple model, easy to query.

I hope that helps!



来源:https://stackoverflow.com/questions/61576225/how-to-setup-this-diagram-multiple-selling-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!