Write one or more triggers to manage the grade attribute of new Highschoolers If the inserted tuple has a value less than 9 or greater than 12, change the value to NULL. On the other hand, if the inserted tuple has a null value for grade, change it to 9. ```

CREATE TRIGGER gradeTrigger1
AFTER INSERT ON highschooler 
WHEN new.grade &lt; 9 OR new.grade &gt; 12 
BEGIN 
    UPDATE highschooler SET grade=NULL WHERE id=new.id; 
END
As i mentioned in the comment.

For your purpose you can use a BEFORE  INSERT trigger

DELIMITER $$
CREATE TRIGGER `gradeTrigger1` 
BEFORE INSERT 
ON highschooler  FOR EACH ROW
BEGIN
    CASE  WHEN  new.grade &lt; 9 OR new.grade &gt; 12  THEN
        SET new.grade = NULL;
    WHEN  new.grade IS NULL THEN
        SET new.grade = 9;
    ELSE
        SET new.grade = NEW.grade;
    END CASE;
END$$
DELIMITER ;