In commands like the where the DROP clause is used
ALTER TABLE DROP <column>
and
ALTER TABLE DROP COLUMN <column>
are both accepted.
Are there any commands in which the COLUMN keyword is not optional or is it optional everywhere?
CodePudding user response:
From MySQL docs
The word COLUMN is optional and can be omitted, except for RENAME COLUMN (to distinguish a column-renaming operation from the RENAME table-renaming operation).
CodePudding user response:
It is clear in the syntax reference where the COLUMN
keyword is optional:
| DROP [COLUMN] col_name
The square-brackets notation in the syntax reference means that the word inside the brackets is optional. See the linked documentation page for other cases of optional keywords.