DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_beforeInsert`
	BEFORE INSERT ON `province`
	FOR EACH ROW
BEGIN
	
    SET NEW.geoFk = zoneGeo_new('province', NEW.`name`,
		(SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk));
	
	SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk);

END$$
DELIMITER ;
