In this article we will see "How to ALTER a TABLE in MySql" and "MySql ALTER TABLE query syntax with example".

"ALTER TABLE - ADD Column" query syntax

"ALTER TABLE" can be used to ADD Column to a TABLE in MySql, the syntax is as follow.


ALTER TABLE tableName
ADD columnName datatype;

"ALTER TABLE - ADD Column" query example

"ALTER TABLE" can be used to ADD Column to a TABLE in MySql, as shown in the example below.


ALTER TABLE testTable
ADD phone varchar(10);


"ALTER TABLE - DROP COLUMN" query syntax

"ALTER TABLE" can be used to DROP Column in a TABLE in MySql, the syntax is as follow.


ALTER TABLE tableName
DROP COLUMN columnName;

"ALTER TABLE - DROP COLUMN" query example

"ALTER TABLE" can be used to DROP Column in a TABLE in MySql, as shown in the example below.


ALTER TABLE testTable
DROP COLUMN name;


"ALTER TABLE - MODIFY COLUMN" query syntax

"ALTER TABLE" can be used to MODIFY Column in a TABLE in MySql, the syntax is as follow.


ALTER TABLE tableName
MODIFY COLUMN columnName datatype;

"ALTER TABLE - MODIFY COLUMN" query example

"ALTER TABLE" can be used to MODIFY Column in a TABLE in MySql, as shown in the example below.


ALTER TABLE testTable
MODIFY COLUMN email varchar(50);

In this article we have seen "How to ALTER a TABLE in MySql", in upcoming articles we will see more about Mysql syntax and queries with example.
  • By Techburps.com
  • Oct 17, 2017
  • MySql