DELIMITER $$USE `db`$$DROP TRIGGER `member_walletinit_trigger`$$CREATE TRIGGER `member_walletinit_trigger` AFTER INSERT ON `member` FOR EACH ROW BEGIN SET @count = (SELECT COUNT(mem_no) FROM `wallet` WHERE mem_no = NEW.reg_no); IF @count = 0 THEN INSERT INTO wallet (mem_no)VALUE(NEW.reg_no); END IF; END;$$DELIMITER ;