
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What MySQL returns when we remove all the columns from a table by using ALTER TABLE command with DROP keyword?
Eventually, we cannot remove all the columns from a table by using ALTER TABLE command with DROP keyword. In this case, MySQL will return an error message. It is demonstrated with the help of the following example
Suppose in table ‘Employee’ we have two columns ‘name’ and ‘id’, now if we will use ALTER TABLE to remove both the columns then MySQL returns an error as follows
mysql> ALTER TABLE employee drop column name, drop column id; ERROR 1090 (42000): You can't delete all columns with ALTER TABLE; use DROP TABLE instead
- Related Articles
- How can we use MySQL ALTER TABLE command for adding comments on columns?
- How can we alter table to add MySQL virtual GENERATED COLUMNS?
- How can we alter table to add MySQL stored GENERATED COLUMNS?
- Set auto increment initial value for MySQL table using ALTER command
- How can we drop UNIQUE constraint from a MySQL table?
- Does MySQL DROP TABLE completely remove the table or just the structure?
- How can we add multiple columns, with single command, to an existing MySQL table?
- What happens with the trigger when we will drop the table having that trigger?
- How can we remove a column from MySQL table?
- Can we remove a primary key from MySQL table?
- ALTER table by adding AUTOINCREMENT in MySQL?
- Rename a table in MySQL using RENAME TABLE command
- How can we list all the columns of a MySQL view as we can list the columns of a MySQL table?
- Remove index from a MySQL table
- What MySQL returns when we alter AUTO_INCREMENT value which is less than current sequence number?

Advertisements