Question: I am trying to create a trigger for a PATIENT table if the patient is younger than 18 to receive an ERROR message age must
I am trying to create a trigger for a PATIENT table if the patient is younger than 18 to receive an ERROR message age must be over 18 to be able to have surgery at this center.
delimiter $$ CREATE TRIGGER Check_dateofbirth BEFORE INSERT ON patient FOR EACH ROW BEGIN IF NEW.dateofbirth < 01-JAN-2003 THEN SET MESSAGE_TEXT = 'ERROR: AGE MUST BE ATLEAST 18 YEARS!'; END IF; END;$$ delimiter;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
