ALTER TABLE

Description

Changes the definition of an existing table

Click herearrow-up-right to navigate to the Redshift documentation page for this syntax.

Grammar Syntax

ALTER TABLE table_name
{
ADD table_constraint
| DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]
| OWNER TO new_owner
| RENAME TO new_name
| RENAME COLUMN column_name TO new_name
| ALTER COLUMN column_name TYPE new_data_type
| ALTER COLUMN column_name ENCODE new_encode_type
| ALTER COLUMN column_name ENCODE encode_type,
| ALTER COLUMN column_name ENCODE encode_type, .....;
| ALTER DISTKEY column_name
| ALTER DISTSTYLE ALL
| ALTER DISTSTYLE EVEN
| ALTER DISTSTYLE KEY DISTKEY column_name
| ALTER DISTSTYLE AUTO
| ALTER [COMPOUND] SORTKEY ( column_name [,...] )
| ALTER SORTKEY AUTO
| ALTER SORTKEY NONE
| ALTER ENCODE AUTO
| ADD [ COLUMN ] column_name column_type
  [ DEFAULT default_expr ]
  [ ENCODE encoding ]
  [ NOT NULL | NULL ] |
| DROP [ COLUMN ] column_name [ RESTRICT | CASCADE ] }

The ALTER TABLE syntax is a grammar that does not fit on just one page, but here is an overview.

Click herearrow-up-right to go to the Redshift Standard specification for this syntax.

Navigate to the following pages to get more details about the translation spec for ALTER TABLE syntax.

circle-info

If there's an alter action missing, consult the PostgreSQL ALTER TABLE.

Last updated

Was this helpful?