SQL query to change column name

SQL query to change column name

In this article, we will find out about the sections of the table and the procedure to change the name of the segment.

By one way or another we all end changing the name of one or name section of the table. This might be a result of different reasons. So the primary concern we have to see is the necessity.

You will require two things:

  • Table Name
  • Section name

At that point essentially state to the database that Alter my table by changing the segment name which you need to be changed and pass another name. That is it.

Table (representative) having three fields and four information in it,

Id		Name		Address

100		Aman		Mumbai
200		Arun		Pune
300		Karan		Delhi

As should be obvious, our table representative having three sections name id, name, address having three lines of information filled in it. Presently, we will adjust the name of the segment (name) to (employeename) and for that, we have to make a modify inquiry with change question in it. At that point we take the outcome set of the considerable number of information and show them on the comfort.

Query:

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

Display table records.

SELECT * FROM employee;

Output:

SQL query to change column name

Recent Posts

error: Alert: Content is protected!!