Skip to main content

SQL Reference

ScramDB is a PostgreSQL wire-compatible SQL database. Connect with psql, any PostgreSQL driver, or any BI tool that supports PostgreSQL.

Compatibility

ScramDB implements the PostgreSQL wire protocol (v3) and supports standard SQL syntax. You can connect using:

psql -h localhost -p 5432 scramdb

Or any PostgreSQL driver:

  • Python: psycopg2, asyncpg, sqlalchemy
  • Rust: tokio-postgres, sqlx
  • Go: pgx, database/sql with lib/pq
  • Java: JDBC PostgreSQL driver
  • Node.js: pg, knex

What's Supported

ScramDB supports a comprehensive subset of SQL with full OLAP capabilities:

CategoryStatusDetails
SELECT with joins, subqueries, CTEsInner, Left, Right, Full, Semi, Anti-Semi
Aggregate functionsSUM, COUNT, AVG, MIN, MAX, STDDEV, VARIANCE, STRING_AGG
Window functionsROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE, + aggregate windows
72 scalar functionsString, math, date/time - see Functions
ExpressionsCASE, BETWEEN, LIKE/ILIKE, COALESCE, NULLIF, IN, EXISTS
DMLINSERT, UPDATE, DELETE, TRUNCATE, COPY FROM/TO
DDLCREATE/DROP TABLE, CREATE INDEX, ALTER TABLE, CREATE VIEW
Set operationsUNION, INTERSECT, EXCEPT (+ ALL variants)
CTEsNon-recursive WITH clauses
GROUPING SETSGROUPING SETS, ROLLUP, CUBE
TransactionsREAD COMMITTED, REPEATABLE READ, SERIALIZABLE
Vector searchpgvector-compatible VECTOR(n) type
Prepared statements⚠️ PlannedPREPARE / EXECUTE
Recursive CTEs⚠️ PlannedWITH RECURSIVE
Stored proceduresNot planned
TriggersNot planned

📊 Data Types

PostgreSQL type compatibility table

📝 Statements

DDL and DML statement reference

⚙️ Functions

72 scalar, aggregate, and window functions