INSERT INTO table IF table exists otherwise CREATE TABLE

database, mysql, sql

Solution

I'd create 2 statements. Try this:

CREATE TABLE IF NOT EXISTS `table` (
id INT(10),
word VARCHAR(500)
);
INSERT INTO `table` VALUES (NULL,"1234");

Problem

Do mysql support something like this? ``` INSERT INTO `table` VALUES (NULL,"1234") IF TABLE EXISTS `table` ELSE CREATE TABLE `table` (id INT(10), word VARCHAR(500)); ```

Original source