patternMinor
Simple table normalisation
Viewed 0 times
simpletablenormalisation
Problem
In raw form, I have data with 2 columns:
Instinctively, the laid out method seems to be correct, but for such a simple task, also seems like overkill?
Thanks!
skills in welsh and stats for that skill. For storing these information in a database, would it be best to combine the stats with the categories, or split them up as below?WELSH_SKILLS_TABLE
----------------------------------------------------
| SKILL_ID | SKILL
----------------------------------------------------
| 0 | CAN'T SPEAK
----------------------------------------------------
WELSH_STATS_TABLE
----------------------------------------------------
| SKILL_FK | COUNT
----------------------------------------------------
| 0 | 235
----------------------------------------------------Instinctively, the laid out method seems to be correct, but for such a simple task, also seems like overkill?
Thanks!
Solution
Without knowing anything else about your system, that seems like total overkill. You'd be better off with a single table that has
Having two tables for such a simple schema will result in unnecessary work for both the DBA and developer. The database engine will need to perform extra work to
If you had a really, really large dataset (think hundreds of millions or billions of rows) and you regularly needed to access just the
ID, Skill, and SkillCount. Having two tables for such a simple schema will result in unnecessary work for both the DBA and developer. The database engine will need to perform extra work to
JOIN the two tables whenever you require reading both Skill and SkillCount at the same time.If you had a really, really large dataset (think hundreds of millions or billions of rows) and you regularly needed to access just the
Skill and rarely needed to show the SkillCount field, then perhaps you might consider using your design.Context
StackExchange Database Administrators Q#50661, answer score: 4
Revisions (0)
No revisions yet.