ALTER

 

The ALTER statement is a way to change a table's definition - i.e. to add or delete an attribute or a constraint.

 

Syntax of the ALTER statement

ALTER TABLE table_name ADD|DROP definition[ CASCADE]

 

Comments

table_name A name of a table to be changed
ADD An attribute or a constraint has to be added
DROP An attribute or a constraint has to be dropped. Not every DBMS support this.
definition If ADD is specified then it is a definition of an attribute or a constraint - see the chapter CREATE for more details. Else it is the name of an attribute or a constraint to be dropped.
CASCADE Because DROP can violate the reference integrity, there can be used CASCADE method to keep this integrity. Otherwise the default method is used.

 

Examples