ADQL uses two primary categories of expressions in ADQL queries:
- Field expressions used in the SELECT clause
- Condition expressions used in the WHERE clause
To build an expression, use field names, functions, numbers, and operators indicated in the described syntax.
Syntax of field_expression (SELECT clause)
Syntax of condition_expression (WHERE clause)
The field expression syntax in the SELECT clause can also contain functions. The syntax of a function_expression is: function
(field_name, arguments, ...)
Syntax Element | Description |
---|
field_name or numeric_field_name | The name of a field in the specified event type. Field names require back quotes when the name contains spaces or special characters. For example, the field name, `full name`, is surrounded by back quotes because it contains a space. See Special Characters for the full list. Use the Events Service internal names in your ADQL queries. The list of default fields and their internal names are described under ADQL Data. |
function | See Analytics Functions. |
numeric_literal | A sequence of digits, optionally including a decimal point ". " or sign {+ | -}. Example: 2, -4, 3.14 |
unary_operator | The - unary operator negates the value of the operand. |
binary_operator | Arithmetic operators: {*, /, %, +, -}. See Math Expressions. |
COMPARISON_OPERATOR | A set of operators that compare values. See Comparison Operators for the full list. |
LOGICAL_OPERATOR | See Logical Operators. |
value | The syntax for a value = {numeric_literal | string | boolean}. Values are text, numbers, dates or boolean values used to compare with the value in the specified field_name. The data type of the value must match the type of the specified field. Text strings require quotes. Numbers, dates, boolean values (true or false) and null do not need quotes. Quotes can be either single or double quotes. |
Instead of specifying that the expression applies to a particular array element, the expression can apply to any array element.
Fields with Spaces or Special Characters
The most likely situation in which spaces and other special characters may be used in naming are when field names are added with data collectors.