What MySQL returns when we remove all the columns from a table by using ALTER TABLE command with DROP keyword?

MySQLMySQLi Database

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
raja
Published on 19-Feb-2018 13:10:18
Advertisements