Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

1) Write a PL/SQL program to find and print the average instructor salary by department. Output should include the department name and the average salary

image text in transcribed 1) Write a PL/SQL program to find and print the average instructor salary by department. Output should include the department name and the average salary for that department. Output should be formatted nicely (investigate the use of lpad, rpad and other formatting options for output in PL/SQL.) 2) Create a trigger that prevents any change to the instructor relation that would drop average instructor salary per department below $40,000. Name this trigger trig_min_avgsal and, again, use the CREATE OR REPLACE option. Your trigger should stop the operation from occuring by using RAISE_APPLICATION_ERROR. This built-in procedure allows a user-defined exception to appear in an Oracle error. The syntax is:

RAISE_APPLICATION_ERROR (error_number, error_message)

where the error number is between -20000 and -20999 and the error message is what you want displayed when the error occurs. NOTE: When you call RAISE_APPLICATION_ERROR, it ends the program and returns a user-defined error number and message to the application. It also generates an exception, which may cause other error messages to be printed.

takes course id grade section course id semester time slot uilding time slot id room no time slot id day start time end time classroom building room no teaches capacity L course id sec id semester Mean Course course id title dept name credits prereq student name dept name tot cred department building budget instructor name L dept name salary advisor sid i id

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_2

Step: 3

blur-text-image_3

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

More Books

Students explore these related Databases questions