I need to get fname, lname, salary of employees who are $400.00 below the average salary even after geting a 10% salary raise.
I'm able to get employees who's salary is below the average salary, but am unsure how to get those who are $400 below after a raise.
I'm using MySQL. Thank you.
select AVG(salary) from employee; #gives me the average salary
select Fname, Lname, Salary, 1.10*Salary as NewSalary
from employee;
#gives me names, old salary and salary raised.
This gives me the employees with salary less than the average salary:
select Fname, Lname, Salary
from employee
where Salary < (select AVG(salary) from employee);
I was thinking something like this, but this doesn't work; unknown column newsalary:
select Fname, Lname, Salary, 1.10*Salary as NewSalary
from employee
where NewSalary - (select AVG(salary) from employee) = 400 ;
WHERE. Instead of the alias repeat the actual expression like...WHERE 1.10 * Salary - (...- sticky bit