title: Creating a BEFORE INSERT TRIGGER IN MYSQL
body: <p>I need help creating a BEFORE INSERT TRIGGER on mySQL Bench. im new to this please.</p>
  
  <pre><code>CREATE TABLE `quincyninying`.`toytracking` (
  `Toyid` INT NOT NULL,
  `ToyName` VARCHAR(50) NULL,
  `Toycost` DECIMAL NULL,
  `ToyAction` VARCHAR(50) NULL,
  `ActionDate` DATETIME NULL,
   PRIMARY KEY (`Toyid`));
  
  CREATE TABLE `quincyninying`.`toy` (
  `Toyid` INT NOT NULL,
  `ToyName` VARCHAR(50) NULL,
  `Toycost` DECIMAL NULL,
  PRIMARY KEY (`Toyid`));
  </code></pre>
  
  <p>Create a BEFORE INSERT trigger on the toy table that adds a record to the toytracking table with the information from the toy table record that is being INSERTED, hard coded ToyAction that will be ‘INSERT’ and the current Date and time the record is inserted. </p>
  
  <pre><code>ERROR 1054: Unknown column 'inserted' in 'NEW' SQL Statement:
  CREATE DEFINER = CURRENT_USER TRIGGER `quincyninying`.`toy_BEFORE_INSERT` BEFORE INSERT ON `toy` 
  FOR EACH ROW
  BEGIN
      IF new.inserted THEN
          SET @toyaction = 'DELETE';
      ELSE 
          SET @toyaction = 'NEW';
      END IF;
  
      INSERT INTO `quincyninying`.`toytracking` (toyId, ToyName, ToyCost,     Toyaction, ActionDate)
      VALUES       (new.toyid, new.Toyname, new.Toycost,@Toyaction, now());
  
  END
  </code></pre>
  
  <p>It throws me an error saying " ERROR 1054: Unknown column 'inserted' in 'NEW' "</p>