Mysql Alter Table

by Rekha 2010-07-30 13:08:30

Mysql Alter Table


The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.

SQL ALTER TABLE Syntax

To add a column in a table, use the following syntax:
ALTER TABLE table_name
ADD column_name datatype


To 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


To change the data type of a column in a table, use the following syntax:
ALTER TABLE table_name
ALTER COLUMN column_name datatype


Renaming a table
ALTER TABLE table_name
RENAME TO new_table_name;

Tagged in:

987
like
0
dislike
0
mail
flag

You must LOGIN to add comments