Skip to main content

Expression

Primitive Expressions

You can use these anywhere you see an <expression> requested.

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>
OpDescription
+Add
-Subtract
*Multiply
/Divide
%Modulo
^Power
OpDescription
==Equal to
!=Not equal to
>Greater than
>=Greater than or equal to
<Less than
<=Less than or equal to
OpDescription
andBoolean AND
orBoolean OR

Unary Operation

Op <expression>
OpDescription
notNot
-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