SQL Delete a column statement
In sql, delete a column statement is used for delete a column from a table. When we don’t need a column we can delete this column.But we lost data in this table and can’t find it.So we use this statement carefully.
Syntax
Alter Table table_name
Drop Column column_name;
Example

In this database first we select a students database by writing use students; .Then we write show tables; to see if there are any tables created. Now we see there are two tables created.One is students and other is students_information.Now we need to see how many data in students_information table.For this we write: select *
from students_information;
We see there are five columns and three row in students_information table.But we don’t need Email column.So we need to delete this column.So we write :
Alter Table students_information
Drop Column Email;
(here students_information is table name and Email is column name)
Now Email column is deleted.So we need to check that is Email is deleted or not!
write : select *
from students_information;

We see that Email column is deleted.
Leave a comment