Alter command in Mysql is used to perform the following task:
-To add new column
-To remove existing table
-To modify the existing column.
-To change the name of the column.
-To change the Table name.
Add new column:
Syntax:
ALTER TABLE table_name
ADD new_column column_datatype
[FIRST|AFTER column_name];
Remove/Delete existing column:
ALTER TABLE table_name
DROP COLUMN column_name;
Change the name of the column:
syntax:
ALTER TABLE table_name
CHANGE COLUMN old_name new_name
column_definition
[ FIRST | AFTER column_name ]
Change the table name:
syntax:
ALTER TABLE table_name
RENAME TO new_table_name;