MySQL Forums
Forum List  »  Newbie

Is my database normalized?
Posted by: Aaaa Aa
Date: June 27, 2010 09:53AM

I made an rpg database to store the character stats of each user. This was before I read up about normalization and now I'm wondering if mine is.
CharacterStats
Username (P)    cClass    Level    CurrentHP    MaxHP
From what I read the primary key is the field that every other field depends on, so Username would be the primary key.

First normal form says that repeating groups of data should be eliminated. I don't think any of the fields are related, except for CurrentHP and MaxHP but they are pretty independant because you can't find the value for CurrentHP using the value from MaxHP or vise versa. So I believe this is in first normal form.

Second normal form says that there should not be redundant data, or repeating data. Obviously cClass and Level can repeat but I doubt they can be simplified.

Third normal form says every field must depend on the primary key. Now MaxHP is going to be dependant on cClass and Level cause of different class stat growth.
What if I remove MaxHP and create a new table like this:
ClassStats
Class (P)    InitialHP    HPGrowth
So to get a user's max HP I select a row from ClassStats, then I multiply the HPGrowth by the Level from CharacterStats and add to it InitialHP, that would give MaxHP.

So is my table normalized now? And is there anything I went about wrong in my process? Also can the primary key have repeating values?

Options: ReplyQuote


Subject
Written By
Posted
Is my database normalized?
June 27, 2010 09:53AM
June 27, 2010 11:54AM


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.