I need to create a stored procedure to update the salary of employees who earn less than 1000 and give a 10% increase. Other employees (who earn over 1000) will have a 15% reduction. I've done the following:
DELIMITER $
CREATE PROCEDURE modificaSalario2()
BEGIN
update Funcionario set Salario=Salario*1.10 where Salario<1000;
update Funcionario set Salario=Salario-(Salario*0.15) where Salario>1000;
END $
DELIMITER ;
The problem is that it is possible to give the increase of 10% and then give the discount of 15%. Ex: an employee who earns R $ 950 receives a 10% increase and starts receiving R $ 1045. Shortly thereafter he will suffer a 15% reduction and earn $ 888.25.