I was wondering, when modeling a database, should inheritance be used if the sub-entities have the exact same attributes?
Let me explain with an example. In competitions for weightlifting, weightlifters do two different moves: "Snatch", and "Clean and jerk". They have three tries for each move. I modeled this in the following way:
At first, it made sense to me, because the two moves have a lot of attributes in common, which are in the parent-entity called Result. However, "Snatch" and "CleanAndJerk" also have completely equal attributes. This seems redundant. Though, it does not seem much better to place everything in the "Result"-entity either.
Is this a good choice when designing a database?
In this situations what you really need is a polymorphic table.
I think it's better if you do it this way:
Move
table. columns: FirstTry
,SecondTry
,ThirdTry
,BestTry
,MoveTypeId
.MoveType
table. columns: MoveTypeId
,MoveTypeName
,MoveTypeDescription
.then simple the Move
has a Foreign Key to MoveType
table.