Question: Write a SQL function that takes department name as input and increase the salary 15% only for the instructors whose salary is less than the
Write a SQL function that takes department name as input and increase the salary 15% only for the instructors whose salary is less than the average salary of the instructors of the department. Make it a similar format to the below example of a function:

DELIMITER // CREATE FUNCTION avgSalaries (deptName varchar (20)) RETURNS decimal (10,2) BEGIN DECLARE dept_avg_salary decimal(10,2); SELECT AVG (salary) INTO dept_avg_salary FROM instructor WHERE dept_name=deptName; RETURN dept_avg_salary; END // DELIMITER
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
