• Advertisement
Sign in to follow this  

[web] Database Design Question

This topic is 3235 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys its been a while since ive posted on gamedev. After taking my database class i found my self working on a project where a user could keep track of their games using mysql database. i just have a question how the schema should be implemented (i guess thats what im asking hehe) lets say i have a table called "game" that has information about any game titles, and a user wants to acknowledge that a certain game is part of their collection. I figure i have two options 1) have a crap ton of repetitious data where each row for a game would have the designated user specified 2) have some way to link a game to a user (if this is the best way, how do i do this) let me know if i have been unclear because im pretty new to db design thanks

Share this post


Link to post
Share on other sites
Advertisement
3 Tables

Game (ID, Name etc)
User (ID, Email, FirstName, Surname, Sex, DOB, etc.)
GameCollection (GameID, UserID)

GameCollection Links users to games in what is called a Join Table.

Primary Keys
Game: ID
User: ID
GameCollection: UserID + GameID
Clustered Index with User First as it will be faster when the user displays their list of games.

Secondary Keys (Unique (Clustered) Indexes )
Game: Name
User: Email

Share this post


Link to post
Share on other sites
should the user table have a password field so they can identify themselves?

Share this post


Link to post
Share on other sites
Quote:
Original post by b1gjo3
should the user table have a password field so they can identify themselves?

If a user needs a password to authenticate then well, yes. Of course you should only store a hash of it, not the plain text password itself.

Share this post


Link to post
Share on other sites
is there a built in type that would convert the password to hash for you? how would i specify a hashed password column

thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by b1gjo3
is there a built in type that would convert the password to hash for you? how would i specify a hashed password column

Not in the database engines themselves as far as I know of. You can use encryption methods that are provided by the programming/scripting language of your choice or a third party library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement