MySQL删除多列 [英] MySQL Drop Multiple Columns
本文介绍了MySQL删除多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试删除多列,但遇到了一些麻烦.当我用括号()
中的多个值进行ALTER TABLE
和ADD
时,以下语法有效,但对于DROP COLUMN
则不起作用.我使用的语法错误吗?
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 brackets ()
but it doesn't work with DROP COLUMN
. Am I using the wrong syntax?
$table3 = "
ALTER TABLE $table3_name
DROP COLUMN (
user_firstname,
user_lastname,
user_address,
user_address2,
user_city,
user_state,
user_zip,
user_phone
);
";
推荐答案
ALTER TABLE `tablename`
DROP `column1`,
DROP `column2`,
DROP `column3`;
这篇关于MySQL删除多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文