Database design question

Associate
Joined
6 Jun 2004
Posts
2,389
Location
London
I am trying to implement an online auction program - very similar to eBay.
At the moment I have tables including Users, Auctions (linked Auctions.SellerID -> Users.UserID), Bids (Bids.Bidder -> Auctions.UserID, Bids.AuctionID -> Auctions.AuctionID)...you get the idea.

The issue I'm facing now is the feedback system... I want one similar to ebay where for each auction, once finished, the seller gets to leave feedback for the buyer and vice versa. So here's what I've thought of so far:

Feedback table, with AuctionID, BuyerID, SellerID and a flag indicating if its a Buyer-to-Seller feedback (ie the Seller gets the feedback rating) or Seller-to-Buyer.
Is this normalised? In theory I could get the highest bidder (ie the Buyer) from the Bids table and the seller from the Auctions table.

OR

Sales table with AuctionID, BuyerID, SellerID - an entry in here means that the Auction is complete and is now a "Sale". From here I have a Feedback table linking to the correct Sale (ie 2 rows in the Feedback table per Sale row if both buyer and seller leaves feedback)....
Is this normalised??!

Basically I havent really got any decent ideas on how to create this in a normalised way.

Can someone help?
 
Thanks for your help rpstewart, I've gone for a similar method to what you described.

A separate issue I am now facing is how to find the highest bidder of an auction:

Code:
SELECT MAX(b.Bid) As Price, b.BidderUserID, b.AuctionID 
FROM Bids b GROUP BY b.AuctionID

Returns an error - so I remove b.BidderUserID and it works (and i do understand the error) but my question is, is there anyway I can run this query, returning the a list of all auctions along with their highest bidder?

Cheers!
 
Wow, quick reply - impressive! Thanks.

Yes, that cures the problem but doesnt give me my required result -

I want to list distinct AuctionIDs, linked to the current highest bidder.

If I do as suggested, I will get the maximum bid EACH user has put forward towards each auction.

Maybe I am a little too expectant of MSSQL but I thought it was possible to link the row returned to the BidderUserID without grouping it into the aggregate function.
 
Last edited:
Back
Top Bottom