
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL: Remove All Columns from a Table Using ALTER TABLE
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
Advertisements