The ALTER TABLE statement applies a schema change to a table.
Note:
To understand how CockroachDB changes schema elements without requiring table locking or other user-visible downtime, see Online Schema Changes in CockroachDB.For information on using ALTER TABLE, see the documents for its relevant subcommands.
| Subcommand | Description |
|---|---|
ADD COLUMN | Add columns to tables. |
ADD CONSTRAINT | Add constraints to columns. |
ALTER COLUMN | Change a column's Default constraint or drop the Not Null constraint. |
DROP COLUMN | Remove columns from tables. |
DROP CONSTRAINT | Remove constraints from columns. |
RENAME COLUMN | Change the names of columns. |
RENAME TABLE | Change the names of tables. |
SPLIT AT | (Documentation pending) Potentially improve performance by identifying ideal locations to split data in the key-value layer. |