MySQL Drop Multiple Columns

后端 未结 2 1590
野的像风
野的像风 2020-12-29 18:13

I\'m trying to drop multiple columns, but having some trouble. The syntax below works when I do ALTER TABLE and ADD with multiple values in the bra

相关标签:
2条回答
  • 2020-12-29 18:48
    ALTER TABLE `tablename`
    DROP `column1`,
    DROP `column2`,
    DROP `column3`;
    
    0 讨论(0)
  • 2020-12-29 19:06

    To drop multiple columns actual syntax is

    alter table tablename drop column col1, drop column col2 , drop column col3 ....
    

    So for every column you need to specify "drop column" in Mysql 5.0.45. This is same as that of above answer. Just adding one point here. Alter table wont free up the actual space on the disk. So run optimize table on after running optimize table.

    0 讨论(0)
提交回复
热议问题