In database table design, how does "Virtual Goods" affect table design -- should we create an instance of a virtual good?
When we design a database table for a DVD rental company, we actually have a movie, which is an abstract idea, and a physical DVD, so for each rental, we have a many-to-many table with fields such as:
TransactionID UserID DvdID RentedDate RentalDuration AmountPaid
but what about with virtual goods? For example, if we let a user rent a movie online for 3 days, we don't actually have a DVD, so we may have a table:
TransactionID UserID MovieID RentedDate RentalDuration AmountPaid
should we create a record for each instance of "virtual good"? For example, what if this virtual good (the movie) can be authorized to be watched on 3 devices (with 3 device IDs), then should we then create a virtual good record in the VirtualGoods table, each with a VirtualGoodID and then another table that has
VirtualGoodID DeviceID
to match up the movie with the DeviceIDs?
We can also just use the TransactionID as the VirtualGoodID. Are there circumstances where we may want to create a record to record this "virtual good" in a VirtualGoods开发者_StackOverflow社区 table?
The answer depends on your exact requirements, and you haven't specified enough of those in this post. For example, is the online rental associated with the abstract DVD or the physical one? Do you rent just the recording of the DVD or do you reserve the physical DVD while it is rented online? From what you are saying do far, I don't think you need a 'virtual good' in addition to what you already have.
精彩评论