それでもゼロ値の挿入を許可します..
CREATE TRIGGER check_my_constraint BEFORE insert ON `personal_details`
FOR EACH ROW
BEGIN
DECLARE msg varchar(255);
IF (NEW.studentid<0)
THEN
SET msg = concat('Constraint my_constraint violated: studentid must not be zero ', cast(new.studentid as char));
SIGNAL sqlstate '45000' SET message_text = msg;
END IF;
END ;