I'm new to DB's, so I'm not really sure how to even formulate the question. Please feel free to edit the question itself. Anyways, let's describe! I should advise that I am using MS-ACCESS for this project.
I have two tables, Pipes and Dives. I need to inspect every pipe, saved in Pipes, with two sensors. These inspections are executed by one or more dives, saved in Dives. The objective is to make the Sensor1 and Sensor2 fields (in meters) be equal to the TotalLength field (also in meters). If that is so, the inspection is considered complete.
Pipes
PipeID (primary key, int) | PipeName (unique text) | Sensor1 (float) | Sensor2 (float) | TotalLength (float)
Dives
DiveID (primary key, text) | DiveDate (date) | Sensor1 (float) | Sensor2 (float)
The problem here is that I do not want to fill in manually the Sensor1 and Sensor2 field on the Pipes table. Those should be automatically filled as a SUM of the dives that actually try to inspect that specific pipe (SUM only the specific contribution to that pipe). Ok then, I could simply add a field with PipeID on the Dives table.
But..
There is the potential situation where one dive can be used to inspect more than one pipe. In fact it is possible that one dive inspects multiple pipes, while a few of those pipes need further dives for inspection! Still, I want my Pipes table to be simple, showing only totals, and my Dives table to also show only totals. Therefore, I believe I need a third table, a child of the marriage of both tables, that describes the relationship between each table. I'm not sure even how to design this, much less the DB innards.
So how can I design such a table?
Sorry for the long introduction to the question, I'll try better in the future.
Aucun commentaire:
Enregistrer un commentaire