Make a new table from the existing HR_EMPLOYEES table, using CTAS: make table a2_employees as select *
Question:
Make a new table from the existing HR_EMPLOYEES table, using CTAS:
make table a2_employees as select * from hr_employees;
Make a PL/SQL procedure to display some information from the newly created table A2_EMPLOYEES and also to update salary, for a specific department ID. The procedure should read row by row using explicit cursor and calculate average salary for the job id that the employee performs. If the salary is lower that the average tor that job ID, then update the employee's salary to the average and display old salary, new salary, and the difference. If the salary is higher than the average, display the salary and the difference from the average salary for that job id. Calculate the total amount of money that the department will need for the salary increase for all its employees.
Provide an anonymous block that will call this procedure for several values of department ID.
You can use the following SQL statements for testing:
select distinct department_id, count(1) from a2_employees group by department_id; select * from a2_employees where department_id = 50 order by job_id, employee_id; An example of the output is displayed bellow: