change column in mysql code example

Example 1: how to alter table column name in mysql

ALTER TABLE your_table_name RENAME COLUMN original_column_name TO new_column_name;

Example 2: mysql add column

ALTER TABLE table_name
ADD [COLUMN] column_name column_definition [FIRST|AFTER existing_column];

Example 3: change column name mysql

ALTER TABLE tableName CHANGE `oldcolname` `newcolname` datatype(length);
(you can remove the backticks if it doesn't work)

Example 4: change column name in mysql

ALTER TABLE tableName CHANGE `oldcolname` `newcolname` datatype(length);

Example 5: mysql alter table add column

ALTER TABLE table
  ADD [COLUMN] column_name column_definition
  [FIRST|AFTER existing_column];

Example 6: change column in mysql

#Alter is used
#alter table TableName change CurrentColumnName NewColumnName Specification(size);
alter table TableName change name firstname varchar(30);

Tags:

Misc Example