ALTER TABLE

On this page Carat arrow pointing down

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.

Subcommands

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 or drop 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.

Viewing Schema Changes New in v1.1

Whenever you initiate a schema change, CockroachDB registers it as a job, which you can view with SHOW JOBS.


Yes No
On this page

Yes No