Here are some worked examples of IDA SQL-queries based on the current data modelG.1.
The SQL-applet which allows expert users to perform these queries is available at the IDC web site under:
http://www.iso.vilspa.esa.es/ Access the Archive SQL Queries
To fully understand these examples it is necessary to know the definitions and the structures of the ISO Data Archive Physical Data Model, [47].
select observations.obsno from observations where observations.target = 'NGC 7582'
select observations.obsno from observations where observations.target like '%HR%6705%'
select distinct observations.obsno from planning_info p, observations where observations.aotname = 'S01' and p.orgra > 0 and p.orgra < 6 and p.orgdec > 30 and p.obsno = observations.obsno NOTE: orgra is in hours and orgdec in degrees. We assume that the observations made, apertures used, are points. The above query can be performed, better, via the browse/request applet interface. This interface will make use of the `positions' table, the actual aperture sizes, and the downlink (IRPH) coordinates.
select observations.obsno from observations where observations.aotname = 'S01' and observations.utc_end - observations.utc_start > 5400
select observations.obsno from observations where observations.aotname = 'S01' and (observations.utc_end - observations.utc_start) > 2400 and (observations.utc_end - observations.utc_start) < 3600
select observations.obsno from observations where observations.aotname = 'S06' and observations.target = 'HR6705 GAMMA-DRA' and obsid = 'SWS_CAL' and (observations.utc_end - observations.utc_start) > 1800 and (observations.utc_end - observations.utc_start) < 2400
select observations.obsno from observations where observations.instid = 'S' and observations.revno >= 079 NOTE: assumed that `data' means all FITS product files (filename and version). The above query can be performed, better, via the browse/request applet interface.
select observations.obsno from observations where observations.instid = 'S' and observations.utc_start > date1 and observations.utc_start < date2 NOTE: date1 and date2 should be converted to UTC in seconds since 1989.
select distinct observations.obsno from observations, wavelengths where observations.aotname = 'S02' and wavelengths.lower > 17910 and wavelengths.lower < 17930 and wavelengths.obsno = observations.obsno
select o1.obsno from observations o1, wavelengths w1 where o1.aotname = 'S02' and (w1.lower > 12800 and w1.lower < 12850) and w1.obsno = o1.obsno and exists (select * from observations o2, wavelengths w2 where o2.aotname = 'S02' and (w2.lower > 15500 and w2.lower < 15600) and w2.obsno = o2.obsno and o1.obsno = o2.obsno)
select obsno, utc_end, aotname into #sws1 from observations where aotname in ('C01','C03','C04') select obsno, fltr_cvf, beam into #sws2 from cam_measurement where fltr_cvf in (12,11) select distinct s1.obsno, s1.utc_end into #sws3 from #sws1 s1, #sws2 s2 where s1.aotname= 'C04' or ((s1.aotname = 'C01' or s1.aotname = 'C03') and (s2.fltr_cvf = 12 or (s2.fltr_cvf = 11 and (s2.beam=3 or s2.beam=4)))) and s1.obsno=s2.obsno select o.obsno, o.utc_start, s3.utc_end from observations o, #sws3 s3 where o.instid = 'S' and abs(o.utc_start - s3.utc_end) < 120 and prodqlty != 'J' NOTE: Assumes that 'following' means 'within 120 seconds of'
select distinct observations.obsno from observations, sws_measurement s where observations.aotname = 'S02' and s.sgnr_req > 200 and observations.obsno = s.obsno
select observations.obsno from observations where aotname = 'P40' and obsid = 'RGENZEL' and revno >= 600
select obsno from cam_cstat group by obsno having count(distinct cstagain) > 1
select obsno from observations where obsno-1 in ( select obsno from observations where cam_par_flag = 'Y' and obsid like '%HUGO%') NOTE: This gives the observations that match, these must then be added to the shopping basket and the type of data requested specified.
select distinct o.obsno from observations o, lspd l where aotname = 'L02' and lspdglvp <= 1000.0 and o.obsno = l.obsno
select distinct o.obsno from observations o, lspd l where aotname = 'L04' and l.lspdadet = 512 and o.obsno=l.obsno
select distinct l.obsno from wavelengths w, liac l where lower <= 88000 and upper >= 88000 and countno=5 and liacwhap=0 and w.obsno = l.obsno
select obsno, lscanrmt, lscaitks, lscaitks from lsca where lscanrmt < x
select distinct obsno from lsan where (lsan.scanb + lsan.scanf) > 20
select distinct obsno from lsca where obsno not in (select distinct obsno from lsca where lscadir != 0)
select obsno, liaciks, liacike from liac where liacres7 > x
select obsno, liaciks, liacike from liac where liacbk1 > x
select obsno, liaciks, liacike from liac where liacwhap = 2 and liacres1 > x or liacres2 > x or liacres3 > x or liacres4 > x or liacres5 > x or liacres6 > x or liacres7 > x or liacres8 > x or liacres9 > x or liacres10 > x
select obsno, lgifitks, lgifitke from lgif where lgif2rel3 > x
select distinct o.obsno from observations o, cam_cstat c, cam_measurement m, raster_map r where c.cstafltw=125 and m.pfov = 1.5 and r.m*r.n > 16 and c.cstaread >= 25 and o.obsno = c.obsno and o.obsno = m.obsno and select distinct o.obsno from observations o, cam_cstat c, cam_measurement m, raster_map r where c.cstafltw=125 and m.pfov = 1.5 and r.m*r.n > 16 and c.cstaread >= 25 and o.obsno = c.obsno and o.obsno = m.obsno and o.obsno = r.obsno select distinct o.obsno from observations o, cam_cstat c, aph a, obs_pointing p where o.obsno=p.obsno and p.pointing_id = a.pointing_id and o.obsno = c.obsno and c.cstafltw=125 and c.cstalnsw=192 and a.scan_dist*a.linedist > 16 and c.cstaread >= 25 o.obsno = r.obsno select distinct o.obsno from observations o, cam_cstat c, aph a, obs_pointing p where o.obsno=p.obsno and p.pointing_id = a.pointing_id and o.obsno = c.obsno and c.cstafltw=125 and c.cstalnsw=192 and a.scan_dist*a.linedist > 16 and c.cstaread >= 25
select distinct t1.obsno, (t1.utc_end - t1.utc_start) from observations t1, raster_map where t1.obsno = raster_map.obsno and (t1.instid = 'C') and (t1.utc_end - t1.utc_start > 3600) and exists (select * from observations t2 where (t2.aotname='C60' or t2.aotname='C61') and (t1.utc_start - t2.utc_end) < 7200) Or, alternatively: select distinct t1.obsno, (t1.utc_end - t1.utc_start) from observations t1, aph a, obs_pointing p where t1.obsno = p.obsno and p.pointing_id = a.pointing_id and (a.reqtype = 'R') and (t1.instid = 'C') and (t1.type != 'C') and (t1.utc_end - t1.utc_start > 3600) and exists (select * from observations t2 where (t2.aotname='C60' or t2.aotname='C61') and (t1.utc_start - t2.utc_end) < 7200) NOTE: The second query is probably better as it uses the aph to distinguish a raster observation. This is generally more accurate than using the raster_map table as this only contains planned uplink values (and so obs which did not go through PGA into the Uplink MDB, such as C99, will not be included). Note, that this query also explicitly excludes CAM parallel observations - these could easily be included if wanted.
select distinct obsno from observations where type='C' and obsno-1 in ( select o.obsno from observations o, raster_map r where instid='L' and r.m*r.n > 9 and utc_end - utc_start > 7200 and o.obsno = r.obsno ) NOTE: Again, this query can also (better) be performed using the aph table.
select o.obsno from observations o, raster_map where o.obsno = raster_map.obsno and (o.instid = 'L') and (o.utc_end - o.utc_start > 3600) and exists (select * from observations o2 where (o2.aotname='C60' or o2.aotname='C61') and (o.utc_start - o2.utc_end) < 7200) Or, alternatively: select o.obsno from observations o, aph a, obs_pointing p where o.obsno = p.obsno and p.pointing_id = a.pointing_id and a.reqtype='R' and (o.instid = 'L') and type = 'S' and (o.utc_end - o.utc_start > 3600) and exists (select * from observations o2 where (o2.aotname='C60' or o2.aotname='C61') and (o.utc_start - o2.utc_end) < 7200) NOTE: This query is restricted to science observations - this could easlily be modified to also return LWS parallel observations.