I am trying to learn how to model a stabilized database in which a player might have multiple classes. What's the relationship between your player and also the class objects?

Each player will have the ability to have multiple classes and every class will grant a person multiple abilities too. I am acquainted with stabilized database and dealing together, but haven't setup many of them on your own, especially not personally.

I am dealing with the MySQL community toolset if anybody includes a handy EER diagram/screenshot they are able to show me too :)

This could normally be handled having a link table for any many-to-many relationship:


Usually with PlayerID, ClassID being the main key, and PlayerID and ClassID being foreign key references for your Class and Player tables.

Typically this is indexed another way too (ClassID, PlayerID) in lots of designs (although possibly not in yours).

Your abilities table could be similarly associated with a category:


Now here's where it will get tricky - what goes on if your player is within two classes which each confer exactly the same skill? Could they be additive or could they be merged, or what? This can be a problem domain problem which would need to be resolved before you simply join these tables altogether and find out what abilities a person has.

The connection could be many to a lot of. Usually patterned by an in-between table:

table Player:       Id int, name varchar(50)
table PlayerClass:  PlayerId int, ClassId int
table Class:        Id int, name varchar(50)

The PlayerClass table must have an overseas key constraint on its posts.

Observe that databases are thought not fast enough for games. Most games make use of a custom storage mechanism.