Database Syntax

OcaltQL has its own native database engine, built entirely for OcaltQL — not a wrapper around SQL, not a third-party library bolted on. Every database belongs to exactly one namespace and is never shared, linked, or exposed outside it.

Where databases live

Every database you create is stored inside your namespace at /root/db. This location is reserved by the platform — it cannot be browsed, listed, written to, or deleted through any file verb. The only way to interact with it is through the database verbs on this page and the next two.

Creating and removing a database

Example
NEW DB "shopdb"

A database must exist before any table can be created inside it. NEW DB creates the database. Attempting to create a table inside a database that does not exist will fail.

Example
DROP DB "shopdb"

DROP DB permanently deletes the entire database — every table, every row, every index inside it. This cannot be undone.

Stateless by design

OcaltQL database statements do not rely on a "currently selected" database the way some SQL clients do. Every statement names exactly which database and table it is operating on, every time:

Example
SELECT ROWS FROM DB "shopdb" TABLE "people" SET ?results

This means two parts of a script running in parallel with AND can safely operate on different databases — or even the same one — without one branch accidentally affecting which database the other branch is reading from.

The WHERE clause

Filtering rows uses comparison operators built specifically for databases, all following the same "column" IS ... shape. Multiple conditions chain with AND (all must match) and OR (either may match).

Operator Matches when
IS IDENTICAL TO / IS EQUAL TOValue equals exactly.
IS NOT IDENTICAL TO / IS NOT EQUAL TOValue does not equal.
IS GREATER THAN / IS LESS THANNumeric comparison.
CONTAINSCase-sensitive substring match.
IS SIMILAR TOCase-insensitive substring match — appears anywhere in the value.
IS PREFIX SIMILAR TOCase-insensitive match — value starts with this.
IS SUFFIX SIMILAR TOCase-insensitive match — value ends with this.
IS NULL / IS NOT NULLColumn is missing or has no value, or does have one.
IS EMPTY / IS NOT EMPTYColumn is null or an empty string, or holds real content.
IS TRUE / IS FALSEFor BOOL columns.
Example
SELECT ROWS FROM DB "shopdb" TABLE "people"
WHERE "email" IS NOT EMPTY AND "name" IS PREFIX SIMILAR TO "al"
SET ?results
Example
SELECT ROWS FROM DB "shopdb" TABLE "people"
WHERE "age" IS GREATER THAN 18 AND "active" IS EQUAL TO true
SET ?results

Setting values with AS

Wherever a database statement needs to supply column values — inserting a row, updating a row — it uses the same "column" AS value pattern, chained with AND, that you already use elsewhere in OcaltQL for setting object keys.

Example
INSERT INTO DB "shopdb" TABLE "people" ROW "name" AS "Alice" AND "age" AS 30

What's next

Continue to Databases & Tables to define table schemas, or jump ahead to Columns & Rows to start working with data directly.