Is there a way to do an insert under a count condition, something like:
INSERT INTO my_table (colname) VALUES(\'foo\') IF COUNT(my_table) < 1
Use SELECT instead of VALUES to be able to expand the query with a WHERE clause.
EXISTS is a better & faster test than COUNT
INSERT INTO my_table (colname) SELECT 'foo' WHERE NOT EXISTS (SELECT * FROM my_table)