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?
In Object Explorer, locate the table from which you want to delete columns, and expand to expose the column names. Right-click the column that you want to delete, and choose Delete. In Delete Object dialog box, click OK.
Syntax. The syntax to drop a column in a table in MySQL (using the ALTER TABLE statement) is: ALTER TABLE table_name DROP COLUMN column_name; table_name.
To permanently remove a table, enter the following statement within the MySQL shell: DROP TABLE table1; Replace table1 with the name of the table you want to delete. The output confirms that the table has been removed.
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.
DROP TABLE table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With