Skip to main content
Turso speaks the SQLite SQL dialect. If you know SQLite, you already know the core of Turso SQL. This reference documents every statement, function, expression, and pragma that Turso supports, along with Turso-specific extensions that go beyond SQLite.

Language overview

Turso uses the same dynamic type system, query planner, and expression grammar as SQLite. Queries run through a bytecode virtual machine that is wire-compatible with SQLite’s VDBE. Most SQLite SQL works without modification. Turso adds a small set of opt-in extensions:
  • Custom types — user-defined types with encode/decode logic, constraints, and operators (STRICT tables only)
  • Array columns — ordered collections of any base type
  • Vector functions — storage and similarity search for F32, F64, I8, and 1-bit vectors
  • Full-text search — Tantivy-powered FTS with BM25 scoring
  • Materialized views — live, incrementally maintained views
  • Concurrent transactions — optimistic MVCC via BEGIN CONCURRENT
For a detailed compatibility matrix listing every statement, expression, function, PRAGMA, and C API function, see SQLite Compatibility.

Reference sections

Data types

Storage classes, type affinity rules, STRICT tables, custom types, and array columns.

Expressions

Literals, operators, CAST, CASE, pattern matching, subqueries, and NULL handling.

Statements

SELECT

Queries, joins, aggregation, window functions, and CTEs.

INSERT

Inserting rows, including INSERT OR REPLACE and INSERT ... ON CONFLICT.

UPDATE

Updating rows with optional RETURNING clause.

DELETE

Deleting rows with optional RETURNING clause.

CREATE TABLE

Table definitions, column constraints, STRICT mode, and WITHOUT ROWID.

ALTER TABLE

Adding columns, renaming tables and columns.

CREATE INDEX

B-tree indexes, partial indexes, and custom index methods (FTS, vector).

Transactions

BEGIN, COMMIT, ROLLBACK, savepoints, and BEGIN CONCURRENT.

EXPLAIN

Inspect the query plan and VDBE bytecode.

All statements

DROP TABLE, DROP INDEX, CREATE VIEW, CREATE TRIGGER, CREATE VIRTUAL TABLE, and more.

Functions

Scalar functions

String, numeric, type, and utility functions.

Aggregate functions

COUNT, SUM, AVG, MIN, MAX, GROUP_CONCAT, and statistical functions.

Math functions

Trigonometric, logarithmic, rounding, and power functions.

Date and time functions

date(), time(), datetime(), strftime(), julianday(), unixepoch().

JSON functions

json_extract(), json_set(), json_array(), json_object(), and JSONB variants.

Vector functions

vector32(), vector64(), vector_distance_cos(), vector_top_k(), and more.

Window functions

ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, and frame-based aggregates.

Pragmas

Pragmas

PRAGMA statements for database configuration, inspection, encryption, CDC, and more.

Build docs developers (and LLMs) love