I am logging scientific data. For this a normal relationship database
is not idéal but I am going to try it.
I have basically three tables like:
datarecord:
* idx - integer
* time - datetime
* type - integer
metadata:
* idx - integer
* unit - varchar(20) (for example m,bar,m/s,celcius)
* name - text (for exampel Pressure, Temperature)
datavalue:
* idx - integer
* rec_id - integer (foreign key pointing to datarecord.idx)
* meta_id - integer (foreign key pointing to metadata.idx)
* value - real
An example dataset would be:
datarecord
idx time type
1 01.02.2006 12:12:00 1
2 01.02.2006 12:13:00 1
metadata:
idx unit name
1 bar pressure
2 celcius temperature
3 degrees heading
4 celcius maxtemp
5 celcius mintemp
datavalue
idx rec_id meta_id value
1 1 1 10.3
2 1 2 44.2
3 1 3 34
4 1 4 55.3
5 2 1 9.2
6 2 2 44.0
7 2 3 48
8 2 4 54.3
9 2 5 22.8
I would like to construct a query that for example could give me time,
pressure, temperature, maxtemperature like:
01.02.2006 10.3 44.2 55.3
01.02.2006 9.2 44.0 54.3
Is this possible with SQL? And how do I do this?
Best regards
Jardar