Thursday, August 27, 2009

MySql: Drop table, rename table, drop foreign key, drop column

SkyHi @ Thursday, August 27, 2009
MySql: Drop table, rename table, drop foreign key, drop column
July 24th, 2009 by jeremychone

#switch to the right DB
USE database_name;

#drop a table
DROP TABLE table_name;

#rename a table
RENAME TABLE table_name TO new_table_name;

#drop a foreign key
ALTER TABLE table_name DROP FOREIGN KEY FK_name;

#drop a column
ALTER TABLE table_name DROP COLUMN column_name;