Delete a column from an existing MySQL table

Contributor Icon Contributed by qmchenry Date Icon March 18, 2004  
Tag Icon Tagged: MySQL

The SQL command in this recipe removes a column and the column’s data from an existing MySQL table.


To delete the column col_stuff from the table table_things, use the following SQL command:

ALTER TABLE 'table_things' DROP 'col_stuff'

Previous recipe | Next recipe |
 
  • Thennarasu
    Ya it works...
  • kiran
    helpful in coding.thank u.
  • Dan
    try myNet.Office
    at: www.NetthruOffice.com
  • Mercy
    Thank u. It is useful
  • mysql
    use it without ( ' )...
  • steve
    yep:

    ALTER TABLE table_things DROP col_stuff
  • Neelesh
    If we want to check whether that column exit, if exist only then delete the column so that our script does not hamper.
  • jaswath
    thanks it solved problem
  • vol
    ALTER TABLE table_things DROP col_stuff;
  • A
    ALTER TABLE room DROP COLUMN y;
blog comments powered by Disqus