SQL constraints: Set the list of fields to show, put constraints and sort key


A basic knowledge of the SQL language and relational databases principles would help to use this form. It is aimed at defining the list of fields or expressions to retrieve, the constraints on individual fields, or combining different fields, and the key used to sort the data.

List of fields or expressions

The comma separated list to be filled in this form can be a list of columns of the database table or of any valid SQL expressions or functions based on these columns. It can also be special fields defined in the table's metadata table, for example to associate a measurement with this error and quality ($field specifications). The '*' character is expanded into the list of all columns.

By default, the form proposes a selection of the most useful parameters that was set in the table's metadata.

Examples:

SQL constraints

This corresponds to the WHERE clause of an SQL selection in the target table.

Sort key

The sort key corresponds to the SQL ORDER BY clause. It may be a single key, like e.g. ra, which will result in sorting the output table in ascending order or ra. Appending the DESC attribute will sort in descending order.
The key may also be composite, like ra, dec, or ra DESC, dec, indicating that the records with equal value of ra will be ordered according to the value of dec. In the second example, the output is first sorted according to ra in descending order, and then according to dec in ascending order.


Home