The data I want to store data that has this characteristics:
- There are a finite number of fields (I don't expect to add new fields);
- There are some columns that are common to all sets of data (a category field, for instance);
- There are some columns that are specific to individual sets of data (each category needs it's own fields);
Here's how it would look like in a regular table:
I'm having trouble figuring out which would be the better way to store this data in a database for this situation.
Bellow are the ideas I already had:
- Do exactly as the tabular table (I would have many NULL values);
- Divide the categories into tables (I would use joins when needed);
- Use JSON type for storing the values (no NULL values and having it all in same table).
So my questions are:
- Is one of these solutions (or one that I have not thought about it) that is better for this case?
- Are there other factors, other than the ones presented here, that I should consider to make this decision?
