skip to main content
SQL statements : DDL statements : ALTER TABLE
 

ALTER TABLE

This statement alters the definition of a table.
To support ALTER TABLE processing, the IP GETSUPPORT operation must return TRUE for IP_SUPPORT_ALTER_TABLE.

Syntax 

ALTER TABLE table_name alter-table-action
alter-table-action = ADD [COLUMN] column-definition
| ADD (column-definition [,column-definition]…)
| DROP [COLUMN] column-identifier
| ALTER [COLUMN] column-identifier
SET DEFAULT default-value
| ALTER [COLUMN] column-identifier DROP DEFAULT
| ADD CONSTRAINT constraint-name UNQIUE
(column-identifier)
| DROP CONSTRAINT
 
column-definition = column-identifier data-type
[DEFAULT default-value]
[column-constraint [column-constraint]...]
 
column-constraint = NOT NULL | UNIQUE [KEY]

Examples

ALTER TABLE Qual.Own.emp ADD COLUMN ID INTEGER;
ALTER TABLE Qual.Own.emp ALTER COLUMN ID SET DEFAULT 10;
ALTER TABLE Qual.Own.emp ALTER COLUMN ID DROP DEFAULT;
ALTER TABLE Qual.Own.emp ADD CONSTRAINT unique_constraint UNIQUE (ID);