Balint
Balint

Reputation: 1

database with lots of columns

I'm trying to plan a database for an RPG game. Given the character table. The character has a lot of attributes, around 80, all of them are not null numbers. And I'm sure I won't need to increase the number of attributes in the future.

What is the best solution for this? Should I store them in one big horizontal table with 80 columns? Or should I slice the attributes into smaller tables based on some logic (intelligence skills, strength skills, etc.)?

Although I could separate the attributes thematically, from the character's perspective, it doesn't matter whether an attribute is intelligence or strength. So, I couldn't further normalize the schema along this logic because these attributes are integral parts of the character and cannot be further broken down.

Upvotes: 0

Views: 22

Answers (1)

Dean
Dean

Reputation: 421

I would consider an Attribute table that stores any and all distinct character attributes for the game along with any attribute descriptions or information and strength caps, etc. Then I would consider a character_attribute bridge table that matches the various characters and their "enrollment" in their attributes. This bridge table might just have two foreign key columns of "character_id" and "attribute_id", perhaps also "attribute_strength" depending on the nature of your game.

This data structure hopefully would give you flexibility in the future. Try searching about third normal form on the web for some reading in this area. Or perhaps reading the paper, "Tidy Data" by Wickham.

Upvotes: 0

Related Questions