How to Rename Table or Column in MySQL Database - MySQL Developer Tutorial

How to Rename Table in MySQL | How to Rename Column in MySQL or MariaDB

Renaming the table or column in MySQL or MairaDB is very easy. You can use below syntax to Rename Table or Rename Column in MySQL or MariaDB.

Rename Table Syntax: 

Use below syntax to rename table in MySQL Database or MariaDB Database.

Alter table tableName
ReName to new_table_Name;

Example : 

Let's say we have customer table and we would like to rename to customer_new, we can use below script to Rename table in MySQL Database.

Alter table customer
rename to customer_new;

Rename Column in MySQL Table:

You can use below script to rename column in MySQL Database table.

Alter table table_name
Rename Column old_column_name to new_column_name;

Example : 

Let's say our customer table has one of the column called "first_name" and we want to rename to "fname". We can use below script.

Alter table customer
Alter column firstname to fname;

Video Demo : How to Rename Table and Rename Column in MySQL Database