📜  触发股票 phpmyadmin - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:25.410000             🧑  作者: Mango

代码示例1
DELIMITER $$
CREATE TRIGGER invlevel_AUPD
AFTER UPDATE ON invlevel 
FOR EACH ROW
BEGIN
  IF NEW.quantity < 20 THEN 
    INSERT INTO orders (productid, amount)
    SELECT productid, amount 
      FROM reorder 
     WHERE productid = NEW.productid;
  END IF;
END$$
DELIMITER ;