Query Service
Syntax
When constructing SQL/ADQL, it is important to adopt the correct syntax. Tables are addressed in the form:
SURVEY_DATARELEASE.TABLE
with a dot (.) as the delimiter. The group name is not included as part of the address. There are dozens of tables from multiple surveys in the Data Central data base, Groups are used to collect scientifically-related tables together, in order to help the user locate the correct table more quickly.
You can find the correct name for each table and column in the Schema Browser on the query page (see the name field highlighted in blue). For example, the GalacticExtinction table from the InputCat group from the GAMA second data release is addressed as:
gama_dr2.GalacticExtinction
ADQL
ADQL is based on the Structured Query Language (SQL), especially on SQL 92. Astronomical data is often stored in tabular data sets, making SQL a convenient access means. ADQL extends SQL 92 to include functions and geometries that are specific to astronomy.
The ADQL language has been defined by the IVOA in the Recommendation of 30 Oct 2008 (Version 2.0) and is mainly used in the Table Access Protocol (TAP).
A subset of the ADQL functions are supported by Data Central:
- CONTAINS returns 1 or 0
- DISTANCE returns value in degrees
- INTERSECTS returns 1 or 0
Example usage:
CONTAINS(POINT(<coordsystem>,<ra>,<dec>),CIRCLE(<coordsystem>,<ra>,<dec>,<radius>))
with ra, dec and radius in degrees.