In database table design, how does "Virtual Goods" affect table design -- should we create an instan

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-04-24T20:00:24Z Indexed on 2010/04/24 20:03 UTC
Read the original article Hit count: 448

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 table?

© Stack Overflow or respective owner

Related posts about table-design

Related posts about database-design