A niave beginners question about database design.
I have an app managing some logger data eg. 1000s of sequential measurements of time, voltage, current, temperature. In addition each sequence run has meta data (date, location, etc).
So I need a table for each set of measurements and a master table listing these tables and the meta data for each.
A couple of questions:
This doesn't really use the fact that all the data tables are the same format - there is no 'array of tables' concept, does this mean anything?
Would I just give each data table a unique name, put that in the main table as a column, then simply substitute it into the SQL select statement - or is there a better way?
edit: The reason for many tables, one per run, is that there might be 10-100 runs each with many 1000s of measurements. If I want to display/query/delete just one run it seemed more natural to have each in it's own table.
It looks like this is a programmer mindset (everything should be collections of separate objects) the database approach seems to prefer - store everything together and use index/cross-references.
You'd have one table (Run) that stores date/time/location and an integer primary key (auto increment).
You'd have another table (Measurements) that stores time/voltage/current/temp, an integer primary key (auto increment), and a FK to Run (just a not-null integer column called RunID).
So 2 tables total.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With