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:

Write a SQL function that takes department name as input and increase

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!