This blog will provide the easiest method to alter a table in MySQL workbench.
How to Alter a Table Name in MySQL Workbench?
To modify the table name in MySQL workbench, follow the provided steps:
- Open the “MySQL Workbench” and select the existing connection.
- Choose the database from which you need to modify the table name.
- Select desired table name, right-click on it, and select the “Alter Table..” option from the appeared drop-down menu.
- Edit the existing name and apply it.
Step 1: Launch MySQL Workbench
At first, search for the “MySQL Workbench” with the help of the Startup menu:
Step 2: Select Connection
Then, click on your desired connection and open it. In our case, we have selected the “LinuxHintDB” database:
Step 3: Choose a Database
Now, select the database which needs to alter a table. In our case, we have clicked on the “mynewdb” database > “Tables” option, and selected the “employee_information” table:
Next, right-click on the “employee_information” table name and select the “Alter Table…” option from the drop-down menu:
Step 4: Alter Table Name
Next, replace the existing table name with the new name by specifying in the below-highlighted fields:
As you can see, we have entered the “employee_data” as a new table name in the required fields and clicked on the “Apply” button:
Next, hit the “Apply” button to apply the “ALTER TABLE” statement:
Step 5: Finish Process
Lastly, click on the “Finish” button after executing the query to end the process:
As you can see, the name of the “employee_information” has been altered into the “employee_data” successfully:
That’s it! We have compiled the method of modifying the name of the table in MySQL workbench.
Conclusion
To alter a table in MySQL workbench, first, launch the “MySQL Workbench” and select the existing connection. Then, go to the particular database, choose the table name, and right-click on it. Next, select the “Alter Table..” option from the opened drop-down menu. After that, provide the new name in the required fields and apply it. This blog demonstrated the easiest way to alter a table in MySQL workbench.