CREATE TABLE
`prod$events`.clicks.
DESCRIBE
table.schema.
ALTER TABLE
WhatALTER TABLE ... ADD COLUMN does depends on what follows the column
name.
A plain column
SQLADD COLUMN requires an AS binding, so a plain column such as
ALTER TABLE t ADD COLUMN c INT is rejected. Add an empty, nullable column
with the SDK instead. See
Add nullable columns.
A computed column
AS <expression> declares a computed column.
The column is committed empty and the expression is stored, not evaluated:
declaring one on a billion-row table costs what declaring one on an empty table
costs. REFRESH COLUMN fills it.
A function column
version pins which
immutable function version fills it, so a later registration does not silently
change what the column means.
Several modifiers narrow what gets computed:
A function returning several values fills several columns at once:
Declaration
WITH accepts auto_refresh_enabled and
auto_refresh_interval_seconds. Function bindings also accept version and
branch. Worker resource options such as num_workers belong on
REFRESH COLUMN ... WITH (...).Table properties
NOT NULL.
sharding and buckets spread the log so concurrent writers do
not contend on one place; bucket sharding names its column, which must be
the table’s unenforced primary key, and inserts into the table then need a
scalar index on that key. maintained_indexes chooses which indexes are kept
current against WAL rows; omitted, every supported index is kept current,
including ones created later. A table with a computed column cannot take a
write-ahead log. See
RTE Compaction for how
the log gets folded back into the table.
Errors and limits
Dropping, renaming, or retyping a column is an SDK operation
(
drop_columns and
alter_columns), not a SQL statement.
CLONE
AT pins the point in the source’s history to clone. A bare integer is a
version and a bare quoted string is a timestamp; VERSION, TAG and
TIMESTAMP say so explicitly, and a tag always needs its keyword: a bare
quoted string cannot be both a tag name and a timestamp.
DROP TABLE
Enterprise job type:
drop_table or drop_object, depending on how the
deployment stores its catalog. See
Object teardown.What to read next
Table
The SDK equivalent, and what a table carries.
Schema evolution
Renaming, retyping and dropping columns from the SDK.