Skip to main content
DB

SQL reference

Data types

The column types of NYXDB, their spellings, bounds and index capabilities, and the NULL rule.

The table below lists the column types and the spellings CREATE TABLE accepts. Type names are case-insensitive.

Column types

SpellingValuesBoundsIndex structures
BOOL, BOOLEANTRUE, FALSEBLOOM, POSTINGS
INT8, INT16, INT32, INT64signed integers of 8 to 64 bitsthe type's rangeMINMAX, BLOOM, POSTINGS
INT128, INT256signed integers of 128 and 256 bitsthe type's rangeMINMAX, BLOOM, POSTINGS
UINT8, UINT16, UINT32, UINT64unsigned integers of 8 to 64 bitsthe type's rangeMINMAX, BLOOM, POSTINGS
UINT128, UINT256unsigned integers of 128 and 256 bitsthe type's rangeMINMAX, BLOOM, POSTINGS
FLOAT32, FLOAT64IEEE binary floating pointMINMAX
DECIMAL(p, s)exact decimal with precision p and scale s1 to 76 digits of precision; s at most pMINMAX, BLOOM, POSTINGS
STRINGUTF-8 text, checked on writeat most 16 MiB per valueMINMAX, BLOOM, POSTINGS
BYTESa byte stringat most 16 MiB per valueMINMAX, BLOOM, POSTINGS
FIXEDSTRING(n)a byte string of fixed length nn from 1 to 1,048,576MINMAX, BLOOM, POSTINGS
DATEa calendar dateyears 0001 to 9999MINMAX, BLOOM, POSTINGS
DATETIME64(p), DATETIME64(p, 'tz')a UTC instant with p fractional-second digitsp from 0 to 9; the time-zone text at most 64 bytes; years 0001 to 9999MINMAX, BLOOM, POSTINGS
UUIDa 128-bit identifierMINMAX, BLOOM, POSTINGS

Parameterized types are checked against their bounds when the statement is parsed. VALID BY and REVISION BY name integer or timestamp columns. ENCODING LOW_CARDINALITY is dictionary encoding and is intended for STRING columns with few distinct values.

Writing values

Values are written as SQL literals. BOOL takes TRUE or FALSE; numeric types take a number; DECIMAL takes a number or a string. STRING, BYTES, FIXEDSTRING, DATE ('YYYY-MM-DD'), DATETIME64 ('YYYY-MM-DDTHH:MM:SS[.fraction]Z') and UUID take a string. The full list is on INSERT.

NULL

  • A column is NOT NULL unless NULL is written after its type in CREATE TABLE or ADD COLUMN.
  • A write that omits a column uses its DEFAULT, or NULL when the column is nullable.
  • Primary-key columns and the columns named by VALID BY and REVISION BY are never null.
  • A comparison with a NULL operand is NULL, AND, OR and NOT follow SQL three-valued logic, and a WHERE keeps only rows whose condition is true. Test for nulls with IS NULL and IS NOT NULL.

Composite and network types

SpellingValues
ARRAY(T)an ordered list of values of type T
TUPLE(T1, T2, …)a fixed sequence of typed fields
MAP(K, V)key–value pairs
JSONa JSON document
IPV4, IPV6network addresses
ENUMone of a declared set of names

Nullability is the NULL column option, and dictionary encoding is ENCODING LOW_CARDINALITY.

On this page