Robert Robert - 4 months ago 11
MySQL Question

mysql add column added question mark after name

I added a column to an existing mysql table using:

ALTER TABLE tablename ADD columnname varchar(10) AFTER anothercolumnname;


When I did a

DESCRIBE tablename;


The added column looked like

columnname?


I am unable to drop the column to try and re-add it, and after I did this I realized I did not use quotes for the names. Is there any way to remove that column? Thank you for any help

Answer

The following should remove the column; use bacticks to escape the table name:

ALTER TABLE tablename DROP column `columnname?`;

But are you certain that you did not accidentally enter a question mark when you added the column?