Expression
Primitive Expressions
You can use these anywhere you see an <expression> requested.
- String Literal
- Numeric Constant
- Null Literal
- Field Reference
- Binary Operation
- Unary Operation (could probably omit this guy)
- List Operation
- Function Call
String Literal
Enlosed in double-quotes. Examples:
"Alaska"
"AK"
"If you need \"quotes\" inside, escape with a backslash."
"A newline character is \n. A tab character is \t."
Numeric Constant
4
10.1234
-20.2
Null Literal
Represents a missing value
null
Field Reference
Refers to a field in a record set. Since data cells may be objects (as in the case of the result of an aggregation function), access the nested values using a dot (.) notation.
q1
q2_05r
brand.label
awareness.val
awareness.n
Binary Operation
<expression> Op <expression>
| Op | Description |
| + | Add |
| - | Subtract |
| * | Multiply |
| / | Divide |
| % | Modulo |
| ^ | Power |
| Op | Description |
| == | Equal to |
| != | Not equal to |
| > | Greater than |
| >= | Greater than or equal to |
| < | Less than |
| <= | Less than or equal to |
| Op | Description |
| and | Boolean AND |
| or | Boolean OR |
Unary Operation
Op <expression>
| Op | Description |
|---|---|
| not | Not |
| - | Negate |
List Operation
<expression> in (<expression1>, <expression2>, ...)
<expression> not in (<expression1>, <expression2>, ...)
Examples:
q1 in (1,2,3)
hhincome not in (8,9)
Function Call
function_name(<args>)
See:
- Date Functions (year, month, quarter, ...)
- String Functions (concat, replace, substr, ...)
- nullif, ifnull