Page 1 of 1

checking if a table exists

Posted: Tue Jun 27, 2006 4:32 pm
by Luke
How would you check to see if a mysql table exists?

Posted: Tue Jun 27, 2006 4:34 pm
by feyd

Code: Select all

SHOW TABLES
or

Code: Select all

SHOW TABLES LIKE 'someName'

Posted: Tue Jun 27, 2006 6:11 pm
by RobertGonzalez
Depending on what you are doing, you may be able to something like this...

Code: Select all

DROP TABLE IF EXISTS `table_name`;
CREATE TABLE IF NOT EXISTS `table_name` (...