Professional Documents
Culture Documents
Database Management System
Database Management System
Management
System
Lecture - 27
© Virtual University of Pakistan
Alter Table Statement
Purpose is to make changes in the
definition of a table already created
through Create statement
Can add, drop attributes or
constraints, activate or deactivate
constraints; the format is
© Virtual University of Pakistan
ALTER TABLE table
{ [ ALTER COLUMN column_name
{ new_data_type [ ( precision [ , scale ] ) ]
[ NULL | NOT NULL ]
]
| ADD
{ [ < column_definition > ]
| column_name AS computed_column_expression
} [ ,...n ]
| DROP
{ [ CONSTRAINT ] constraint_name
| COLUMN column } [ ,...n ]
| { CHECK | NOCHECK } CONSTRAINT
{ ALL | constraint_name [ ,...n ] }
} © Virtual University of Pakistan
Alter Table Command
ALTER TABLE Student
add constraint fk_st_pr
foreign key (prName) references
Program (prName)
Lecture - 27
© Virtual University of Pakistan