Skip to main content

CREATE TABLE

CREATE TABLE publishes a general typed Table in the console's configured, authorized catalog. SQL and typed callers use the same schema, lifecycle owner and recovery contract. Compilation does not provision resources, choose an owner or grant permissions. Board and Flight query routes remain read-only.

CREATE TABLE people (id INT64, name UTF8);

CREATE TABLE employees (
id INTEGER PRIMARY KEY,
name VARCHAR(200) NOT NULL,
department_id INTEGER,
active BOOLEAN DEFAULT TRUE,
salary DECIMAL(18, 2)
);

The first statement creates two nullable columns without a user primary key. The second declares an int32 primary key and a five-column schema. Use the console catalog configuration for remote connections; the local server supplies a catalog automatically.

Syntax and types​

CREATE TABLE [IF NOT EXISTS] name (
column_name data_type [NULL | NOT NULL] [DEFAULT constant] [PRIMARY KEY],
...
[, PRIMARY KEY (column_name, ...)]
);

Schemas admit 1–128 columns within a 64 KiB encoded-schema budget. Names contain 1–255 decoded UTF-8 bytes. Unquoted identifiers fold ASCII case to lowercase; double quotes preserve case and escape a quote by doubling it. Column names are distinct after normalization.

Types and aliases cover signed/unsigned integers through 128 bits, finite float32/64, decimal, boolean, UTF-8, binary, date, time, civil/UTC timestamp, interval, UUID, struct, list, fixed array, map, tagged union and JSON. INTEGER/INT means int32; BIGINT/INT64 means int64. VARCHAR(n) counts Unicode scalars and rejects overlength values. Parameters are validated, never parsed and ignored.

Omitted nullability defaults to nullable. A declared primary key implies NOT NULL; explicit NULL on a key is contradictory. Keys may be single or composite. There is no implicit first-column key. Without a key, duplicate values have separate stable internal row identities.

Defaults are deterministic typed constants, including the supported nested constructors. They apply to omitted INSERT fields and DEFAULT; explicit NULL never selects a default. Defaults must satisfy the column's type, nullability and character limit. See the DDL value grammar.

Primary keys admit integer, finite float, decimal, boolean, UTF-8, binary, date, time, timestamp and UUID columns. Interval, nested values and JSON are not key types. Keys compare canonical typed values; text uses exact UTF-8 bytes without collation or normalization. Floating zero signs compare equal for keys.

Publication and recovery​

The caller needs current inspect and create rights as well as native access. The owner reserves a never-reused object identity, stages bounded schema work, then atomically publishes the live name, metadata, head and original outcome. Staged bytes alone do not make the Table available. Authorized catalog SELECT and DML resolve the published Table through the same configured owner.

IF NOT EXISTS records an unchanged outcome for an existing name. It neither checks that the existing schema matches the proposed one nor alters or adopts that Table. An exact retry recovers the original outcome; changed intent under an occupied operation identity rejects. A native send receipt establishes input admission, not successful creation.

The SQL service saves exact intent and signed steps before sending. The console checks the original request after uncertainty and reports an unconfirmed outcome if necessary. A newly issued CREATE is new work. Current inspection rights govern outcome and metadata reads, including after later schema changes or name reuse.

UNIQUE, CHECK, named constraints, foreign keys, generated/identity columns, collations, CREATE TABLE AS SELECT and transaction sessions are unsupported. These forms reject before mutation. ALTER TABLE, DROP TABLE and typed DML have their own selected profiles; storing a type does not qualify every relational operator on it.

The Table schema, DDL compiler and catalog owner define exact identity, encoding, publication and ownership rules.