A literal is a compile-time constant value. CQL supports Boolean, null, string, integer, long integer, date/time, quantity, and ratio literals.

Examples

Boolean and null literals

true
false
null

Numeric literals — integer, decimal, and long

42
3.14
1000000L

String literal

'hello, world'

Date, time, and datetime literals

@2024-01-15
@T14:30:00
@2024-01-15T14:30:00+05:00

Quantity and ratio literals

5 'mg'
5 'mg' : 10 'mL'
Railroad Diagram
100%
true false null STRING NUMBER LONGNUMBER DATETIME DATE TIME quantity ratio

scroll to zoom · drag to pan · click green rules or blue tokens to navigate

EBNF

literal
  : ('true' | 'false')
  | 'null'
  | STRING
  | NUMBER
  | LONGNUMBER
  | DATETIME
  | DATE
  | TIME
  | quantity
  | ratio
  ;

Used In