How about, I'm doing a tool lending system and I need to update the stock of products every time a product comes in or out of the warehouse, I have not used triggers in mySQL and this is being a bit complicated.
This is the Trigger that I have written, the trigger will be triggered every time a new record is inserted in the "INCLUDE" table updated "STOCK" in the "PRODUCT" table, but every time this happens it shows an error of that the column has not been found.
DELIMITER $$
USE 'DemoDos'$$
CREATE DEFINER = CURRENT_USER TRIGGER 'DemoDos'.'restarStock' AFTER INSERT
ON 'INCLUYE' FOR EACH ROW
BEGIN
Update 'PRODUCTO' set 'STOCK' = 'STOCK' - 'New.CANTIDAD_ENTREGADA'
where 'ID_PRODUCTO' = 'ID_PRODUCTO';
END$$
These are the tables in question.
I hope you can help me and thank you in advance!