Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change (Update) column name in table using MySQL workbench?

I am new to MySQL. I created a table with column name First Name but it is wrong.

Now I want to change my column name First Name to First_Name. Is it possible? If yes please explain how I can change my column name.

like image 480
dsl Avatar asked Oct 13 '15 04:10

dsl


People also ask

How do I change a column name in MySQL workbench?

To change a column name, enter the following statement in your MySQL shell: ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name; Replace table_name , old_column_name , and new_column_name with your table and column names.

Can you rename a column in MySQL?

To rename a column in MySQL the following syntax is used: ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name; This command is used to change the name of a column to a new column name.

How do I change a column value in MySQL workbench?

To change the name, data type, default value, or comment of a column, double-click the value to edit it. You can also add column comments to the Column Comment field. It is also possible to set the column collation, using the list in the Column Details panel.


1 Answers

You can change it by following these step :

  1. Right click the table shown at the left in Schema tab of workbench and then select Alter Table. You will get a window like this -> enter image description here

  2. Here you can see the column names available, edit here and click on apply.

You are done.

like image 167
Kshitij Kulshrestha Avatar answered Sep 29 '22 06:09

Kshitij Kulshrestha