Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions