ALTERTABLEemployeedropcolumnname,dropcolumnid;ERROR1090(42000) :Youcan'tdeleteallcolumnswithAL"/> ALTERTABLEemployeedropcolumnname,dropcolumnid;ERROR1090(42000) :Youcan'tdeleteallcolumnswithAL">

Home  >  Article  >  Database  >  What does MySQL return when we delete all columns from a table using ALTER TABLE command with DROP keyword?

What does MySQL return when we delete all columns from a table using ALTER TABLE command with DROP keyword?

PHPz
PHPzforward
2023-08-24 12:09:02748browse

当我们使用带有 DROP 关键字的 ALTER TABLE 命令从表中删除所有列时,MySQL 返回什么?

Finally, we cannot delete all columns from the table using the ALTER TABLE command with the DROP keyword. In this case, MySQL will return an error message. Demonstrate with the help of the following example

Suppose in the table "Employee" we have two columns "name" and "id", now if we delete these two columns using ALTER TABLE, then MySQL will return the 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

The above is the detailed content of What does MySQL return when we delete all columns from a table using ALTER TABLE command with DROP keyword?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete