Home » SQL

SQL query to change column name

In this article, we are going to learn about the columns of the table and the process to change the name of the column.
Submitted by Manu Jemini, on March 11, 2018

Somehow all of us end changing the name of one or name column of the table. This may be because of various reasons. So the main point we need to see is the requirement.

You will need two things:

  1. Table Name
  2. Column name

Then simply say to the database that Alter my table by changing the column name which you want to be changed and pass a new name. That’s it.

Table (employee) having three fields and four data in it,

Id		Name		Address

100		Aman		Mumbai
200		Arun		Pune
300		Karan		Delhi

As we can see, our table employee having three columns name id, name, address having three rows of data filled in it. Now, we are going to alter the name of the column (name) to (employeename) and for that, we need to create an alter query with change query in it. Then we take the result set of all the data and display them on the console.


ALTER TABLE employee 
CHANGE COLUMN 'name' 'employeename' VARCHAR(45) ;

Display table records.

SELECT * FROM employee;


SQL query to change column name

Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.

Comments and Discussions

© https://www.includehelp.com (2015-2018), Some rights reserved.

close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.