I am a newbie in php and just learning about it. in between this my sir give me one task to delete column of the table. how can we delete only one column of table. for example my table have 3 fields. ID,NAME,STATUS. it have 500 of data. and i just have to delete status from whole table using mysql query. what can i do?
Asked
Active
Viewed 155 times
-2
-
1Just Google "mysql delete column". The command you want to read up on is `ALTER TABLE`. That's the mysql command. You should be able to figure out how to do that in php. – lurker Jun 22 '17 at 16:36
-
as i told you i am newbie. and i have tried alot to find it out. but i didn't got the answer. this is the reason why i posted it here. – abhishek chopda Jun 22 '17 at 16:39
-
You are expected to try to **write the code yourself**. After [**doing more research**](https://meta.stackoverflow.com/q/261592/1011527) if you have a problem **post what you've tried** with a **clear explanation of what isn't working** and provide [a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Read [How to Ask](http://stackoverflow.com/help/how-to-ask) a good question. Be sure to [take the tour](http://stackoverflow.com/tour) and read [this](https://meta.stackoverflow.com/q/347937/1011527). – Jay Blanchard Jun 22 '17 at 16:47
-
Even a newbie knows how to do a search, yes? :) But a link has been provided for you in the duplicate flagging. You should be all set! – lurker Jun 22 '17 at 16:50
1 Answers
2
You can write an ALTER
query, e.g.:
ALTER TABLE mytable
DROP COLUMN status;

Darshan Mehta
- 30,102
- 11
- 68
- 102