Increase Salaries with JOIN
Здравейте,
Защо решението на задачата :
Increase Salaries
Write a SQL query to increase salaries of all employees that are in the Engineering, Tool Design, Marketing or Information Services department by 12%. Then select Salaries column from the Employees table.
се приема за верен от Judge следния код:
UPDATE employees
SET salary=salary+salary*0.12
WHERE department_id IN (1,2,4,11);
SELECT salary FROM employees;
А с този дава 100% грешен резултат:
UPDATE employees
SET salary=salary+salary*0.12;
SELECT e.salary AS Salary
FROM employees AS e
JOIN departments AS d
ON e.department_id= d.department_id
WHERE d.name='Engineering' OR d.name='Tool Design' OR d.name='Marketing' OR d.name='Information Services'
group by e.salary;