I’m attempting to figure out how to model a normalized database where a player may have multiple classes. What is the relationship between the player and the class objects?
Each player will be able to have multiple classes and each class will then grant a player multiple skills as well. I’m familiar with normalized database and working with them, but haven’t set up a lot of them from scratch, especially not for myself.
I’m working with the MySQL community toolset if anyone has a handy EER diagram/screenshot they can show me as well 🙂
This would normally be handled with a link table for a many-to-many relationship:
Usually with PlayerID, ClassID being the primary key, and PlayerID and ClassID being foreign key references to your Class and Player tables.
Typically this will be indexed the other way as well (ClassID, PlayerID) in many designs (although possibly not in yours).
Your skills table would be similarly linked to a class:
Now here’s where it gets tricky – what happens if a player is in two classes which each confer the same skill? Are they additive or are they merged, or what? This is a problem domain issue which would have to be resolved before you can simply join these tables all together and see what skills a player has.