Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database as fileformat

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.

like image 236
Martin Beckett Avatar asked Feb 15 '26 03:02

Martin Beckett


1 Answers

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.

like image 80
colithium Avatar answered Feb 17 '26 17:02

colithium