For example, let's say I'm building a database for an auction system, in which various users can partake in both selling and bidding on different items, I'd want for an "Auction" instance to also store the highest bidder (Which should obviously be updated each and every time someone bids way higher than the previous highest bid).
How would I achieve something like that?
Best Answer
Split things in two --
Some table(s) would hold the 'current' info, such as the latest bid for a given item.
Some table(s) would keep the 'history', such as a list of all the bid values and who, when, what, etc.
When a new bid comes in, you would do two things:
UPDATE
a row in the first table andINSERT
a row into the second table.By separating "current" from "history" it may help you think through how to structure the data and formulate the queries.