INSERT INTO`directory_country_region`(`country_id`,`code`,`default_name`)SELECT *FROM(SELECT'BR','RJ','Rio de Janeiro')AStmp WHERE NOTEXISTS(SELECT`default_name`FROM`directory_country_region`WHERE`default_name`='Rio de Janeiro')LIMIT1;

INSERT INTO`directory_country_region_name`(`locale`,`region_id`,`name`)SELECT *FROM(SELECT'pt_BR',LAST_INSERT_ID(),'Rio de Janeiro')AStmp WHERE NOTEXISTS(SELECT`name`FROM`directory_country_region_name`WHERE`name`='Rio de Janeiro')LIMIT1;