ALTER TABLE
Modifies the definition of an existing table in the database.
Syntax
ALTER TABLE table-specification
(
[
DROP ( column-name [
,...]
)
|
ADD ( column-name data-type
[
DEFAULT default-value ]
[
NOT NULL ]
[
PRIMARY KEY [
contraint-name ]
|
UNIQUE [
contraint-name ]
|
CHECK ( sql-condition ) [
contraint-name ]
|
REFERENCES table-name
[
( column-name [
,...]
) ]
[
ON DELETE CASCADE ]
[
contraint-name ]
]
[
BEFORE column-name
[
,...]
)
|
MODIFY ( column-name data-type
[
DEFAULT default-value ]
[
NOT NULL ]
[
PRIMARY KEY [
contraint-name ]
|
UNIQUE [
contraint-name ]
|
CHECK ( sql-condition ) [
contraint-name ]
|
REFERENCES table-name
[
( column-name [
,...]
) ]
[
ON DELETE CASCADE ]
[
contraint-name ]
]
[
,...]
)
|
DROP CONSTRAINT constraint-name
|
ADD CONSTRAINT
{
PRIMARY KEY ( column-name [
,...]
) [
contraint-name ]
|
UNIQUE ( column-name [
,...]
) [
contraint-name ]
|
CHECK ( sql-condition ) [
contraint-name ]
|
FOREIGN KEY ( column-name [
,...]
)
REFERENCES table-name
[
( column-name [
,...]
) ]
[
ON DELETE CASCADE ]
[
contraint-name ]
}
|
LOCK MODE ( {
PAGE |
ROW }
)
|
MODIFY NEXT SIZE integer
]
[
,...]
)