Sunday, January 19, 2025
HomeProgrammingHow to delete a column from a table in MySQL?

How to delete a column from a table in MySQL?

To delete a column from a table in MySQL, use the ALTER TABLE statement with the DROP COLUMN clause. Here’s the syntax:

ALTER TABLE table_name DROP COLUMN column_name;

For example, if you want to delete the column age from the users table:

See also  How Do I Compare Strings in Java?

ALTER TABLE users DROP COLUMN age;

This will remove the age column from the users table permanently. Make sure to back up any important data before making such changes, as this operation is irreversible.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x