Tuesday, 29 May 2012

ALTER TABLE STATEMENTS

SQL ALTER TABLE Syntax

Add a column in a table, use the following syntax:

        ALTER TABLE table_name
        ADD column_name datatype
 
Delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):

        ALTER TABLE table_name
        DROP COLUMN column_name
 
Change the data type of a column in a table, use the following syntax:

1) My SQL / SQL Server / MS Access:

ALTER TABLE table_name
ALTER COLUMN column_name datatype
 
2) Oracle:

ALTER TABLE table_name
MODIFY column_name datatype
 
 
You can try it... 
Hopes it will helps you

No comments:

Post a Comment