A warning: I'm very new to databases! Hopefully this will be a pretty simple question.
To simplfy my problem, I have a tree of 'meters' that collect data (Let's say electricity meters). I'd normally structure this with objects in a tree, each with a list or some kind of array of data. However, I'm trying to get some experience with databases, and this kind of system really should be based on a database.
So, my solution is this:
One Table containing the meters, any information around them (units etc) and their tree relationship/ID/readable name, contact for maintinence, you name it.
But how should I structure the other table that actually contains the data? I.e the half hourly, say, electricity readings?
With my normal OO style, I'd have this as a data structure with two columns: ID, A datetime stamp, and a value.
But with SQL I don't want a table for each meter, right? So do I have: ID, meterID, dateTime, Value and store all the data in the same table? I'd access individual meter's data by extracting from the meterdata table on MeterID (So, if I had two meters with 1000 entries, there'd be 2000 rows - and each 'MeterID' would be repeated 1000 times,
1,Meter1, 01/02/2014, 01:00, 123
2,Meter1, 01/02/2014, 01:30, 125
3,Meter1, 01/02/2014, 02:00, 127
4,Meter2, 01/06/2013, 14:00, 18000
5,Meter2, 01/06/2013, 14:30, 17000
6,Meter2, 01/06/2013, 16:00, 18000
Thanks (total SQL newbie)