1. Home
  2. SQL
  3. MySQL Tutorial
  4. MySQL – Alter Table

MySQL – Alter Table

Use ALTER TABLE query on MySQL database to change the table structure. For example you need to add extra column, delete some column or change the database type, size of any column.

Syntax:

ALTER TABLE table_name
  [alter_specification [, alter_specification] ...]

ALTER TABLE – Add Column

Use following example command to add new column to existing table at first column.

Adding new column after specific column.

ALTER TABLE – Drop Column

You can delete any existing column from MySQL database table. You can face issue with deletion of column due to foreign key or other constraints.

ALTER TABLE – Modify Column

You can also modify the existing column of database table using alter table query. Remember that changing the column may loss of existing data. For example to shorten the size of filed may truncate the extra content from columns.