MySQL Forums
Forum List  »  Newbie

Re: Design Issue
Posted by: Preston McMurry
Date: April 04, 2005 04:05PM

Pretty much, yeah.

Each table contains only data which describes the thing the table represents.

CHARACTER
pk: char_id (I always use a mnemonic name to avoid confusion between two fields, in different tables, with the same name)
-other fields-

ITEM
pk: item_id
-other fields-

Since a character may have many items, and an item may potentially have many characters (unless it is an artifact ;-), you need a joining table:

CHARACTER_ITEM
fk: char_id
fk: item_id

Which would contain one record for each item that each character posesses. The two keys, taken together, are usually unique. If a character may posess multiple instances of the same item, then you could either have one record for each instance, or add a quantity field.

http://prestonm.com ... http://www.mcmurry.com

Options: ReplyQuote


Subject
Written By
Posted
April 04, 2005 11:41AM
Re: Design Issue
April 04, 2005 04:05PM
April 04, 2005 09:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.