Lexical syntax
Identifiers, literals, comments, parameters, intervals, and statement boundaries.
Identifiers
Unquoted identifiers are case-insensitive. Quote an identifier with double quotes when it contains punctuation, conflicts with a keyword, or must preserve its spelling:
CREATE TABLE "minute-bars" (
"open" Float64,
market String,
PRIMARY KEY (market)
) SETTINGS mode = 'keyed', storage_policy = 'memory_data';String values use single quotes. Escape a single quote by doubling it:
SELECT 'operator''s console' AS label;Literals
NYXDB accepts integer, decimal, floating-point, string, Boolean, NULL, array,
tuple, map, date/time, UUID, IP, JSON, and vector-compatible literals where the
target type permits them. Cast ambiguous values explicitly:
SELECT
cast('2026-07-09', 'Date') AS day,
cast('42', 'UInt64') AS value;Interval literals are used by windows and emission policies:
INTERVAL 5 SECOND
INTERVAL 250 MILLISECOND
INTERVAL 1 MINUTEComments
Use -- for a line comment and /* ... */ for a block comment:
-- current state for one account
SELECT * FROM balances WHERE address = 'alice';Parameters
Prepared statements support positional placeholders:
SELECT market, amount
FROM trades
WHERE market = $1 AND amount >= $2
LIMIT $3;The anonymous ? form is also accepted by compatible clients. Bind values
through the driver; never construct SQL by concatenating untrusted text.
Parameterized views declare typed parameters and are invoked by position or name:
CREATE VIEW account_balance AS
SELECT address, balance
FROM balances
WHERE address = ${address:String};
SELECT * FROM account_balance(address => 'alice');Named parameters are supported for parameterized-view invocation. Named
parameters are not accepted in LIMIT or OFFSET.
Statement boundary
Each protocol request carries one SQL statement. The following transaction statements are rejected by the current engine:
BEGIN;
START TRANSACTION;
COMMIT;
ROLLBACK;
SAVEPOINT checkpoint_1;Design atomicity around a single statement and the durability policy of the target table. See Transactions.