Mysql: RENAME TABLE IF EXISTS

后端 未结 8 1258
甜味超标
甜味超标 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 01:54

    Eight years after your question, MariaDB added the exact syntax you want in version 10.5.2: https://mariadb.com/kb/en/rename-table/

    IF EXISTS
    MariaDB starting with 10.5.2
    If this is directive is used, one will not get an error if the table to be renamed doesn't exist.

提交回复
热议问题