1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Write a PL/SQL block to display the department name and the total salary expenditure of the...

Discussão em 'Outras Linguagens' iniciado por Stack, Julho 12, 2021.

  1. Stack

    Stack Membro Participativo

    Display the department name and the total salary expenditure of the department from the Employee table.

    To find the department name and the salary of the person from the particular department must be the output.

    THIS IS THE EMPLOYEE TABLE:

    EMP_ID EMP_NAME SALARY DEPT
    101 Tom 54000 MECH
    102 William 43000 CSE
    103 John 34560 MECH
    104 Smith 56000 CSE
    105 Steve 23450 IT


    CODING:

    I have tried this but i didn't get the output can somebody help me to get the output.

    set serveroutput on;
    DECLARE
    Dept varchar2(25);
    Employee_salary VARCHAR2(25);
    SELECT
    Employee_salary
    FROM
    Employee;
    WHERE salary=23450;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(‘Department-wise salary expenditure :’ || Dept salary);
    END;
    /


    And the Sample Output:

    Department-wise salary expenditure:
    IT department, total salary is 48000
    CSE department, total salary is 79000
    MECH department, total salary is 80000

    Continue reading...

Compartilhe esta Página

Para os pais de Plantão algumas dicas