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!
Advertisement
Answer
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!