"Better" is a subjective term, so I will deal with a more objective problem-space, that is, the avoidance of inconsistencies and redundancies.
Now, let's assume that you have many tables:
all of which have some relatedness to the same creationDate
, targetDate
and actualDate
fields.
Now, if there could be some rules according to which some fields accross tables have a functional dependency or even equivalence between two column set, then having these fields for both ti and tj where i <> j makes it redundant, which sooner-or-later can easily lead to inconsistencies.
So, to cope with this situation, in that case it makes sense to have a generic_attributes
table and linking your records to them either via foreign keys or many-to-many tables.
Of course, these generic attributes can be created as
- generic_attributes(id, att1, ..., attm)
or
- generic_attributes(id, name) and
- generic_attribute_values(id, generic_attribute_id, value)
but, if there are interrelatedness, particularly functional dependencies or conditional functional dependencies, or even functional equivalence, then a separate table for the attributes makes a lot of sense.
Otherwise, if these tables are not related at all, then you can choose either.