You can create a PL/SQL block to calculate and display the average salary of employees in a specific department:
DECLARE
avg_salary NUMBER;
BEGIN
SELECT AVG(salary) INTO avg_salary FROM employees WHERE department_id = 1;
DBMS_OUTPUT.PUT_LINE('Average Salary for Department 1: ' || avg_salary);
END;
/
Leave a Reply