Syntax

To rename a column using the ALTER TABLE command, here is the generic syntax:

ALTER TABLE table_name
RENAME COLUMN column_name TO new_column_name;

In MySQL, for the version before MySQL 8, you use ALTER TABLE ... CHANGE ... syntax:

ALTER TABLE table_name 
CHANGE [COLUMN] column_name new_column_name data_type(length);

In MS SQL Server, you can use sp_rename instead:

sp_rename 'table_name.column_name', 'new_column_name', 'COLUMN';

Example

We have table employees:

CREATE TABLE employees (
  emp_no int(11) NOT NULL,
  birth_date date NOT NULL,
  first_name varchar(14) NOT NULL,
  last_name varchar(16) NOT NULL,
  gender enum('M','F') NOT NULL,
  hire_date date NOT NULL,
  email text,
  PRIMARY KEY (emp_no)

And now we need to change the column birth_date to dob:

ALTER TABLE employees
RENAME COLUMN birth_date TO dob;

Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and manage Oracle, MySQL, SQL Server, PostgreSQL and many other databases simultaneously using an intuitive and powerful graphical interface.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

Need a quick edit on the go? Download for iOS

TablePlus in Dark mode