Reputation: 29658
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....
Almost like TRUNCATE for fields maybe?
Upvotes: 6
Views: 13370
Reputation: 78125
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.
Upvotes: 14