MySql - table DROP "independently", if ELSE exists, creates table "whatever"?

I just want to drop the table “independently” if it exists, and then recreate the “all” table in one query, if possible.

DROP TABLE IF EXISTS `whatever` ELSE CREATE TABLE `whatever` 

Any idea?

+4
source share
1 answer
 CREATE TABLE `whatever` IF NOT EXISTS ELSE TRUNCATE `whatever` 

Use TRUNCATE to clear the table and reset power, rather than delete the table and recreate it.

+6
source

Source: https://habr.com/ru/post/1385176/


All Articles