mysql触发从dob自动计算年龄并创建年龄字段插入数据

laawzig2  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(169)
DELIMITER $$

CREATE TRIGGER example
     BEFORE INSERT ON dates FOR EACH ROW
     BEGIN
     declare age int;
          IF ((set age = AND (select * , year(curdate())-year(dob) ) < 18)
          THEN
               CALL `'Cannot add or update row: only one active row allowed per type'`;
          END IF;
     END;
$$

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题