Page 1 of 1

delete columns

Posted: Tue May 31, 2005 7:42 pm
by jaymoore_299
is it possible to delete a column from a table in mysql using php?
If not, how can I make sure that column is empty and then copy all the other columns to a different table, then delete the first table?

Posted: Tue May 31, 2005 8:01 pm
by Skara

Code: Select all

ALTER TABLE 'table' DROP 'column'

Posted: Tue May 31, 2005 8:28 pm
by jaymoore_299
thanks, how about adding a column?

Posted: Tue May 31, 2005 8:47 pm
by hawleyjr

Code: Select all

ALTER TABLE `db`.`table`
  ADD COLUMN `NewField` int(11) NULL;

ALTER TABLE `db`.`table`
  DROP COLUMN `NewField`;