Drop table if exists

fake01

New Member
Messages
24
Reaction score
0
Points
0
I was just wondering how I would go about dropping a table if it exists. I don't have much knowledge of MySQL and have been using PHPMyAdmin to create, insert, edit, delete and drop tables.

But I'm currently creating a .sql script which will create and insert all the default tables and data and want to drop tables if they already exist. So how will I achieve this?
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
simple.
Code:
DROP TABLE IF EXISTS `Table_I_Want_To_Drop`
 

fake01

New Member
Messages
24
Reaction score
0
Points
0
Cheers

But is it:
PHP:
DROP TABLE IF EXISTS `Table_I_Want_To_Drop`

or
PHP:
DROP TABLE IF EXISTS Table_I_Want_To_Drop;

Or can both be used?
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
both can be used.
I just like to use `` to refer to table names
 
Top