I am designing database for my app. I am using PostgreSQL. It has to be generic app and real world structure looks like this:
Category (e.g. vegetation) ---> Phenomenon (e.g. tree) ---> Parameters (e.g. type - coniferous vs. deciduous, height in meters - 10 and so on)
The database can store a lot of categories, phenomenons, parameters and their values. One category can have N phenomenons, one phenomenon can have N parameters.
So I created these tables:
Category
--------
id
name
Phenomenon
----------
id
name
category FK (to Category)
Parameter
---------
phenomenon FK (to Phenomenon)
name
value <-- here is a problem
In value column can be value from dictionary, varchar value, numeric value or boolean value. How can I design Parameter table? Should I make more columns for different types of value (varchar - can be dictionary value without integrity check, numeric, boolean). Or is there any design considering this problem? I don't want use JSON or XML.
I am really appreciate for any help.