Data types
On this page
ScopeQL values have a data type that determines which operations accept them. Use these type names in column definitions, casts, and function arguments.
List of data types
| Type | Description |
|---|---|
int | Signed 64-bit integer, from -9223372036854775808 to 9223372036854775807. |
uint | Unsigned 64-bit integer, from 0 to 18446744073709551615. |
float | 64-bit floating-point number, including infinities and NaN. |
string | UTF-8 text. |
binary | Sequence of bytes. |
boolean | TRUE or FALSE. |
timestamp | Instant in time, expressed as signed 64-bit nanoseconds from the Unix epoch. |
interval | Duration expressed as signed 64-bit nanoseconds. |
array | Ordered sequence of values, which may have different types. |
object | String keys mapped to values, which may have different types. |
any | A value of any supported type, including an array or object. |
float comparisons use a total order: NaN equals itself and is greater than every other non-NULL float value. Positive and negative zero compare equal. See comparison operators.
NULL values
NULL represents a missing value. Use IS NULL or IS NOT NULL to test for it; value = NULL returns NULL, not a boolean answer.
Use a typed NULL when the intended type is otherwise ambiguous, for example NULL::string or NULL::array. This matters in VALUES, where the first row determines each column's type. Here the first checkout event has no campaign, but later events supply a string:
VALUES ('evt-17', NULL::string), ('evt-42', 'spring')
SELECT $0 AS event_id, $1 AS campaign+----------+----------+
| event_id | campaign |
+----------+----------+
| evt-17 | NULL |
| evt-42 | spring |
+----------+----------+Related types and conversions
- Date and time data types: timestamp ranges, time zones, and intervals.
- Semi-structured data types: arrays, objects, and
anyvalues. - Data type conversion: explicit casts and implicit conversions.