Mysql: RENAME TABLE IF EXISTS

后端 未结 8 1260
甜味超标
甜味超标 2020-12-10 01:08

This DROP TABLE IF EXISTS works, too bad that RENAME TABLE IF EXISTS doesn\'t work.

Can anyone suggest a solution for this query?



        
相关标签:
8条回答
  • 2020-12-10 02:13

    First create table IF NOT EXISTS. Then RENAME it, so it will always exist!

    Otherwise, rename the table, and if it doesn't exist just handle the error.

    It is obvious, but it works.

    0 讨论(0)
  • 2020-12-10 02:13

    rename table oldtablename to newtablename

    0 讨论(0)
提交回复
热议问题