I created a database for an app, where I have several networks, which have several nodes and elements and also several scenarios, all related to the networks. [see picture below]
My question is: since the
sce_paramaters will have result and parameter information of the
elements of a network, should I also build this relationship between the
elements tables and
sce_paramaters tables via foreign-keys?
or since it gets complicated, the way I created the tables are fine? Maybe more general question, when it is good to build these relationships via the foreign-keys?
So far I though since
elements have their names, I can match them with the
name columns in
sce_paramaters tables, after I download all the necessary data for doing further calculations or creating result plots, etc... Therefore I do not really need this relationship from my point of view. What do you think?
Network1: Nodes: [Node1, Node2, Node3] Elements: [Element1, Element2] Scenarios: [ScenarioX] ScenarioX: Paramater: [Pressure_Node1 = 5, Pressure_Node2 = 10, ...] Result: [Flow_Node1 = 100, ...] # In this case nodes table looks like: id | net_id | name | ... | x | y 1 1 Node1 2 1 Node2 ... # In this case sce_parameter table looks like: id | sce_id | name | extension | value | unit 1 1 Node1 Pressure 5 2 1 Node2 Pressure 10 ...