MySql - Create Table If Not Exists Else Truncate?

前端 未结 6 1676
隐瞒了意图╮
隐瞒了意图╮ 2020-12-31 00:23

Here is the updated question:

the current query is doing something like:

$sql1 = \"TRUNCATE TABLE fubar\";
$sql2 = \"CREATE TEMP         


        
6条回答
  •  猫巷女王i
    2020-12-31 00:46

    how about:

    DROP TABLE IF EXISTS fubar;
    CREATE TABLE fubar;
    

    Or did you mean you just want to do it with a single query?

提交回复
热议问题