Update using a join
SQL
Medium
3 views
Problem Description
Give 10% hike to Employees in department 'Tech'. Departments table has dept_name.
Output Format
DML statement(s)
Sample Test Case
Input:
Employees(emp_id, dept_id, salary), Departments(dept_id, dept_name)
Constraints
Use join update syntax your DB supports
Official Solution
UPDATE Employees e SET salary = salary * 1.10 FROM Departments d WHERE e.dept_id = d.dept_id AND d.dept_name = 'Tech';
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!