如何在MySQL中删除表格中的每一列? [英] How can I remove every column in a table in MySQL?
本文介绍了如何在MySQL中删除表格中的每一列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MySQL中,有一种方法可以删除表中的每个字段,而无需使用:
In MySQL, is there a way to drop every field in my table, short of using:
ALTER TABLE `table`
DROP COLUMN d1,
DROP COLUMN d1,
etc....
也许几乎像TRUNCATE一样?
Almost like TRUNCATE for fields maybe?
推荐答案
当您尝试删除最后一列时,您将得到一个错误:
You'll get an error when you try to drop the last column:
ERROR 1090 (42000): You can't delete all columns with ALTER TABLE; use DROP TABLE instead
全部说明!没有一个表具有零列的方法.
Says it all! There's no way to have a table with zero columns.
这篇关于如何在MySQL中删除表格中的每一列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文