MySql - Create Table If Not Exists Else Truncate?
Here is the updated question: the current query is doing something like: $sql1 = "TRUNCATE TABLE fubar"; $sql2 = "CREATE TEMPORARY TABLE IF NOT EXISTS fubar SELECT id, name FROM barfu"; The first time the method containing this is run, it generates an error message on the truncate since the table doesn't exist yet. Is my only option to do the CREATE TABLE , run the TRUNCATE TABLE , and then fill the table? (3 separate queries) original question was: I've been having a hard time trying to figure out if the following is possible in MySql without having to write block sql: CREATE TABLE fubar IF