I want to insert some data on my table if the table is empty (0 rows).
I tried this:
IF NOT EXISTS(SELECT 1 FROM `account_types`)
THEN
INSERT INTO `account_types` (`type`, `group`) VALUES ('400', 'test');
INSERT INTO `account_types` (`type`, `group`) VALUES ('401', 'test2');
END IF;
But I get
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS(SELECT 1 FROM
account_types
) THEN INSERT INTO `account_types' at line 1
What can I do ? I'm using MYSQL