Home > Database > Mysql Tutorial > body text

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

PHPz
Release: 2023-08-24 12:09:02
forward
721 people have browsed it

当我们使用带有 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
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!