Examples
Provide temperatures - if available - for a location, at all times. Here, location is 'Potsdam-Telegrafenberg', combining information from two tables, plate and exposure.
SELECT DISTINCT e.plate_id, e.ut_start, e.year_start, p.air_temperature
FROM applause_dr3.plate as p, applause_dr3.exposure as e
WHERE p.plate_id = e.plate_id
AND p.air_temperature IS NOT NULL
AND p.site_name = 'Potsdam-Telegrafenberg'
order by e.year_start;
Retrieve the telescopes used in the archives
SELECT t2.archive_id, t2.archive_name, t1.telescope
FROM applause_dr3.plate as t1,applause_dr3.archive as t2
WHERE t2.archive_id = t2.archive_id
GROUP BY t1.telescope ,t2.archive_name,t2.archive_id
ORDER BY t1.telescope
From Simbad one gets the Tycho-2 designation: TYC 2673-2051-1 for the star V466 Cyg. Since the lightcurve table contains tycho2_id, we use this column to query for all stars with the tycho2_id = '2673-2051-1' . The quotes indicate that this is a string-value. The table is ordered by the time of observation. Note: For DR1 (raw_lightcurve) and DR2 (lightcurve) you have to pad the middle number to 6 digits: tycho2_id='2763-02051-1'
SELECT year_mid,bmag FROM applause_dr3.lightcurve
WHERE tycho2_id='2673-2051-1' AND year_mid IS NOT NULL
ORDER BY year_mid
DR3 observer query, combining information from 2 tables (plate and preview)
SELECT t1.date_orig, t1.plate_format, t2.filename, t1.observer
FROM applause_dr3.plate AS t1
LEFT JOIN applause_dr3.preview AS t2 USING (plate_id)
WHERE t1.observer LIKE '%Schwarzschild%'
ORDER BY t1.plate_id;
Query the plate table for information on a special observer. (DR2 and DR1)
SELECT date_orig,plate_format,filename_preview, observer
FROM applause_dr2.plate
WHERE observer LIKE '%Schwarzschild%'
Select plate previews and scans for an archive (301=Tartu Observatory)
SELECT s.plate_id, s.filename_scan, p.filename
FROM applause_dr3.scan AS s
LEFT JOIN applause_dr3.preview AS p USING (plate_id)
WHERE s.archive_id=301
AND p.filename IS NOT NULL
ORDER BY s.plate_id;
Count the number of plates for each archive
SELECT s.archive_id, a.archive_name, a.institute, COUNT(DISTINCT s.plate_id) as plate_count
FROM applause_dr3.scan as s, applause_dr3.archive as a
WHERE a.archive_id=s.archive_id
GROUP BY s.archive_id,a.archive_id,a.archive_name,a.institute
ORDER BY s.archive_id
Extract all logbooks and their pages from the '1m Spiegelteleskop'
SELECT lp.logpage_id, lp.filename, lb.logbook_title
FROM applause_dr3.logpage AS lp
JOIN applause_dr3.logbook AS lb USING (logbook_id)
where lb.logbook_title like '1m Spiegel%'
ORDER BY lb.logbook_title
The plate table contains availabale information about used instruments and telescopes, their sizes and characteristics
SELECT DISTINCT(archive_id), telescope, instrument, observatory, site_name
FROM applause_dr3.plate
Get information about objects within the box defined by the coordinates
SELECT * from applause_dr4.source_calib
where ra_icrs between 75.15 and 75.20
AND dec_icrs between 24.1 and 24.15
ORDER BY plate_id
Retrieve all plates, where object with ucac4_id is found on. This query retrieves also the information from plates scanned twice, as this example shows
SELECT plate_id,scan_id, raj2000,dej2000, natmag
FROM applause_dr3.source_calib
WHERE ucac4_id = '571-013776'
Get a list of all objects on a plate. Combining this list with e.g. the plate table, you would a lot of redundant information. Better is to query the tables separately in this case.
SELECT *
FROM applause_dr3.source_calib
WHERE plate_id = 44633
ORDER BY source_id
You have a given plate and want to get a list of all sources which were not matched to UCAC4 or Tycho2 stars.
SELECT *
FROM applause_dr3.source_calib
WHERE ucac4_id IS NULL
AND tycho2_id IS NULL
AND plate_id = 544
ORDER BY source_id
The cone search uses the construct 1 = CONTAINS(POINT('ICRS', sc.ra_icrs, sc.dec_icrs), CIRCLE('ICRS',245.8962, -26.5222, 0.5)) from ADQL. With a join, the elongation is retrieved from the source table.
SELECT sc.source_id, sc.ra_icrs, sc.dec_icrs, s.elongation
FROM applause_dr4.source_calib AS sc
LEFT JOIN applause_dr4.source AS s ON sc.source_id = s.source_id
WHERE 1 = CONTAINS(POINT('ICRS', sc.ra_icrs, sc.dec_icrs),
CIRCLE('ICRS',245.8962, -26.5222, 0.5))