If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > multiple relationship problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-05-04, 14:00
TomDot TomDot is offline
Registered User
 
Join Date: Apr 2004
Posts: 1
Smile multiple relationship problem

Dear All,
I am having a problem that you might be able to help me with.

I am making a small online game, to be deployed to a 1.5m user base. It's a kind of buying/selling game. In the game, there are three important entities, shop, user and item. Each user may only possess 50 or so items at once.

The problem is how to do the shop, user and item relationship. I would like the shop table related to the item table, so a shop can own an item, but then when a user buys an item, the item related to the user.

I suppose I am wondering whether to create shop_item and user_item tables, have multiple foreign keys in the item table (is this allowed)? or something like that.

Is there a right (or good way) to do this?


thanks in advance!

Tom
Reply With Quote
  #2 (permalink)  
Old 04-05-04, 14:22
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
A "small" game deployed to a 1.5 M user base seems like a contradiction in terms to me!

You need to decide what the relationship really is before you can effectively decide how to implement that relationship. From the standpoint of ownership (in the real world), a shop is just a special case of a person. Is that what you want to model?

In most of the games that I've written, shops had infinite quantities of items (beats me how they managed that, they just did). If that is the case, you only need to track when a person "owns" the item.

Once you decide how you want the items to behave, the model should come to you pretty quickly.

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On