I have a database with the data of many experiments. These experiments contain some generic attributes, but also some experiment-specific attributes. As a small example, the database can look like this:
TABLE 1:
ID | attr1 | attr2 | exp_type | more_attrs |
---|---|---|---|---|
1 | x | y | type1 | 1 |
2 | x2 | y | type1 | 2 |
3 | x | z | type2 | 1 |
type1:
ID | extra_attr1 | extra_attr2 |
---|---|---|
1 | a | c |
2 | ab | c |
type2:
ID | other_attr1 | other_attr2 | other_attr3 |
---|---|---|---|
1 | d | e | f |
Where all the experiments are stored in a general table, and have some specific extra information based on the experiments.
Currently, when I want to join these tables on a query, I fetch the exp_type and merge on a table based on that value. But as well supported joining on primary keys is, this way of working feels not as intended..
As there could always come new experiment types, adding a column for a reference to every possible type is not really an option.
So my question basically is: Is this the way to go? Are there better ways to reference tables? Or is the structure of my database just badly designed? And what would be a better design?