Would you like to learn how to add a column to an existing table? In this tutorial, we are going to show you how to use the MySQL command-line to add a column to a table.
• Ubuntu 18.04
• Ubuntu 19.04
• MySQL 8.0.18
Tutorial MySQL - Add a column to a table
Access the MySQL command-line.
Access the MySQL database.
Describe the MySQL table.
Here is the command output:
Add the a new column to the USERS table.
In our example, we create a new column named WEBSITES to store 50 characters.
To Add the a new column and specify the column location, use the following command:
In our example, we create a new column named PROFILE.
We set its location to be after the column named SENHA.
We also set its default value to be 0.
Congratulations! You are able to add a column to a Mysql table.