Introduction
In this tutorial, we want to modify an existing table by using a SQL Statement. In order to do this, we use the ALTER TABLE Statement.
We have already created a table called student.
![](https://www.deeplearningnerds.com/content/images/2023/10/image-6.png)
The table has the following columns:
![](https://www.deeplearningnerds.com/content/images/2023/10/image-7-1-1.png)
Example 1 - ADD COLUMN
We want to add a new column called "country" to the table student.
We navigate to the table student, open the Query Tool and execute the following SQL statement:we want to add the column "country" to the table student.
ALTER TABLE student
ADD country VARCHAR(50);
We can see that the column "country" has been successfully added.
![](https://www.deeplearningnerds.com/content/images/2023/10/image-8.png)
Example 2 - RENAME COLUMN
Next, we want to rename the column "country" to "city".
We navigate to the table student, open the Query Tool and execute the following SQL statement:
ALTER TABLE student
RENAME COLUMN country TO city;
We can see that the column "country" has been successfully renamed to "city".
![](https://www.deeplearningnerds.com/content/images/2023/10/image-9.png)
Example 3 - DROP COLUMN
Now, we want to delete the column "city".
We navigate to the table student, open the Query Tool and execute the following SQL statement:
ALTER TABLE student
DROP COLUMN city;
We can see that the column "city" has been successfully deleted.
![](https://www.deeplearningnerds.com/content/images/2023/10/image-10.png)
Conclusion
Congratulations! Now you are one step closer to become an AI Expert. You have seen that it is very easy to modify a table with the ALTER TABLE Statement. Try it yourself!
Also check out our Instagram page. We appreciate your like or comment. Feel free to share this post with your friends.