DROP COLUMNS
Function
This command is used to delete one or more columns from a table.
Syntax
ALTER TABLE [db_name.]table_name DROP COLUMNS (col_name, ...);
Parameter Description
Parameter |
Description |
---|---|
db_name |
Database name. If this parameter is not specified, the current database is selected. |
table_name |
Table name. |
col_name |
Name of a column in a table. Multiple columns are supported. It consists of letters, digits, and underscores (_). |
Precautions
After a column is deleted, at least one key column must exist in the schema. Otherwise, an error message is displayed, and the column fails to be deleted.
Examples
Assume that the table contains four columns named a1, b1, c1, and d1.
System Response
If you run the DESCRIBE command, the deleted columns will not be displayed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.