Reputation: 13110
I'm going to build a schema for the following XML file:
<Item ItemID="1045677572">
<Bids>
<Bid>
<Bidder Rating="1097" UserID="catann1">
<Location>Longmont, Colorado</Location>
<Country>USA</Country>
</Bidder>
<Time>Dec-10-01 06:43:24</Time><Amount>$0.99</Amount>
</Bid>
...
</Bids>
<Seller Rating="87" UserID="efritz68"/>
</Item>
XML: Location and Country information is optional for Bidder. But, Seller don't need that information. A bidder can be a seller at the same time. A user may bid on multiple items. In that case, his Rating, Location, and Country information are the same across all bids. A user may have two separate ratings as a bidder and a seller, in case the seller is also bidding on other item(s)
I'm not sure which schema is more optimal to store Users. Here's my schema:
Upvotes: 0
Views: 40
Reputation: 425258
Your schema is (whether you like it or not):
Item (ItemID, SellerUserID, ...)
User (UserID, BidRating, SellRating, ...)
Bid (UserID, ItemID, Amount, Timestamp, ...)
Your XML is a denormalized version of this schema.
Upvotes: 1