I have the products table with id(auto_increment) and product fields.
After each INSERT into the products table, I want the product name to be prefixed with the id value
Using the instructions below, I manage to rename the "product" field, however, the id value returned is always 0.
DELIMITER //
CREATE TRIGGER prefixo_produtos
BEFORE INSERT ON products
FOR EACH ROW
BEGIN
SET NEW.product = CONCAT(NEW.id, '_', NEW.product);
END; //