Syntax

Identifiers

An identifier is a name matching [a-zA-Z_][a-zA-Z0-9_]* that is not a reserved word. Identifiers are case-sensitive. Keywords must be written in lowercase. Quoted identifiers are not supported.

points          -- valid
myTable         -- valid
select          -- reserved; cannot be used as a bare identifier

Literals

42              -- integer
3.14            -- float
-1              -- negative number
'hello'         -- single-quoted string
"hello"         -- double-quoted string (equivalent)
'it\'s'         -- escaped single quote
"say \"hi\""    -- escaped double quote
'a\nb'          -- newline escape
'a\\b'          -- escaped backslash
'\u263A'        -- unicode escape (☺)
true            -- boolean
false           -- boolean
null            -- null
{"x": 1, "y": 2}  -- object with string keys
{...t, "z": 3}  -- object with spread
[1, 2, 3]       -- array
[1, 2, ]        -- array with trailing comma

String literals use either '...' or "..." (interchangeable, JSON-style). Backslash escapes:

  • \" — double quote
  • \' — single quote
  • \\ — backslash
  • \n — newline
  • \t — tab
  • \r — carriage return
  • \0 — null byte
  • \uXXXX — unicode scalar (4 hex digits; surrogates paired JSON-style)

The opposite delimiter needs no escape inside a string.

Comments

Single-line comments begin with -- and run to end of line. Block comments are not supported.

select x from t;   -- this is a comment

Reserved Words

The following words are reserved and may not appear as bare identifiers:

KeywordRole
allSubquery quantifier
andLogical conjunction
anyType name
arrayType name
asSource alias in from
ascAscending sort order
atAttribute name in pivot / unpivot
betweenRange predicate
boolType name
byorder by / group by clause
clearclear statement
copycopy statement
createcreate table statement
deletedelete statement
descDescending sort order
dropdrop table statement
existsSubquery existence test
falseBoolean literal
floatType name
fromfrom clause
groupgroup by clause
havinghaving clause
inMembership predicate
insertinsert statement
intoinsert into target
intInteger key-column type
isNull and truth tests
limitlimit clause
notLogical negation
nullNull literal
numberType name
objectType name
orLogical disjunction
orderorder by clause
pivotpivot clause
selectselect clause
stringString key-column type
tablecreate table / drop table / clear table
tocopy … to target path
trueBoolean literal
unknownis unknown test
unpivotunpivot source
wherewhere clause