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
| Area | Page |
|---|---|
| Database lifecycle | Databases |
| Tables, columns, and schema changes | Tables And Schema |
| Indexes and index DDL | Indexes |
| Inserts, updates, and deletes | Writing Data |
| SELECT, filters, grouping, and ordering | Querying Data |
| Transactions | SQL Transactions |
| SHOW, DESCRIBE, and EXPLAIN | Schema Inspection |
| Parameter placeholders | SQL 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.