[web] Database Design Question
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
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
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
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.
is there a built in type that would convert the password to hash for you? how would i specify a hashed password column
thanks
thanks
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.
MySQL and PHP both have functions for MD5 and SHA1.
http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html
http://www.php.net/md5
http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html
http://www.php.net/md5
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement