MySQL delete column

53 Views Asked by At

Want to delete column from table

Iam trying delete column from table but get error code 1064 You have error in your SQL syntax : check the manual that corresponds to your

ALTER TABLE tablename
DROP COLUMN MyUnknownColumn[0]

column name

1

There are 1 best solutions below

2
Nishant Gupta On

The error in your MySql syntax is because you are using square brackets '[ ]' . To drop a column from a table, you should use the following syntax:

ALTER TABLE tablename
DROP COLUMN MyUnknownColumn;