Forum Moderators: coopster

Message Too Old, No Replies

1 table or 2?

         

dkin

4:29 am on Jan 3, 2005 (gmt 0)

10+ Year Member



I will be creating a database for a new game I plan on making, now, the table will be laid out like so.

ID
Name
Password
Address
City
State
Country
Zip
Character Name
Character Type
etc
etc

Now should I have the user info in one table and the character info in another or should they both be in the same table?

bobnew32

6:31 am on Jan 3, 2005 (gmt 0)

10+ Year Member



Depends, if one user can have more than one character then DEFINITELY yes to having two tables. If a user can only have one character, I don't see why you couldn't have them in one table.

dkin

8:49 am on Jan 3, 2005 (gmt 0)

10+ Year Member



for each user account there will be one character.

jatar_k

7:46 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would think 2

the way I look at it there will be things attributed to users that has nothing to do with characters and things for characters that are not connected to users.

timster

8:01 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree that two tables are better. Otherwise, you can bet you'll eventually use "Name" when you mena "Character Name."

Keep an eye towards flexibility when you design your data. A user is a user and a character is a character. In a "future version," maybe you'll want multiple characters per player, characters with no player, etc. Right now you want to ensure a one-to-one correspondence between player and character. That's all possible with 2 tables.