I have a question about database relationship
I am trying to build a monitoring system with the following rules :
Channelsbelongs to oneSensorSensorsbelongs to oneDeviceDevicesbelongs to oneProbeProbesbelongs to oneCore
Here is a preview of the tables
+-------------+ +-------------+
| Cores | | Probes |
+-------------+ +-------------+
| id | | id |
| fields ... | | fields ... |
+-------------+ | core_id |
+-------------+
+-------------+ +-------------+ +-------------+
| Devices | | Sensors | | Channels |
+-------------+ +-------------+ +-------------+
| id | | id | | id |
| fields ... | | fields ... | | fields ... |
| probe_id | | device_id | | sensor_id |
+-------------+ +-------------+ +-------------+
Now to get the core_id of a spécific channel or the full list of a core's channels, I need to join all the five tables.
My question is, would it be better to have all tables linked together like the following example or it's a bad database design.
- Cores(id, fields...)
- Probes(id, fields..., core_id)
- Devices(id, fields..., core_id, probe_id)
- Sensors(id, fields..., core_id, probe_id, device_id)
- Channels(id, fields..., core_id, probe_id, device_id, sensor_id)