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
INSERT INTO `account_types`(`type`, `group`)
SELECT * FROM
(SELECT '400' `type`, 'test' `group` UNION ALL
SELECT '401' `type`, 'test2' `group` UNION ALL
SELECT '402' `type`, 'test3' `group`) A
WHERE NOT EXISTS (SELECT NULL FROM account_types B WHERE A.type=B.type);
Demo
http://sqlfiddle.com/#!9/d1e80e/1