Skip to main content

SQL

CamusDB uses a compact SQL dialect for database lifecycle, schema changes, writes, reads, indexes, and transactions.

SQL keywords are case-insensitive. Unquoted identifiers and backtick identifiers are normalized to lowercase.

Statement Reference

AreaPage
Database lifecycleDatabases
Tables, columns, and schema changesTables And Schema
Indexes and index DDLIndexes
Inserts, updates, and deletesWriting Data
SELECT, filters, grouping, and orderingQuerying Data
TransactionsSQL Transactions
SHOW, DESCRIBE, and EXPLAINSchema Inspection
Parameter placeholdersSQL Parameters

Common Workflow

CREATE DATABASE IF NOT EXISTS app;

CREATE TABLE robots (
id OID PRIMARY KEY NOT NULL,
name STRING NOT NULL,
year INT64 DEFAULT (2024)
);

CREATE INDEX robots_year_idx ON robots (year DESC);

INSERT INTO robots (id, name, year)
VALUES (GEN_ID(), "R2-D2", 1977);

SELECT id, name, year
FROM robots
WHERE year >= 1970
ORDER BY year DESC;

Query Features

For joins, subqueries, derived tables, grouped aggregate behavior, table hints, and planner notes, see Query Features.

For plan selection and plan inspection, see Query Planning and Explaining Queries And Commands.