Pages

Pages

Write a PL/SQL Program to display the department number, department name, location and number of employees. The department which is having more than three employees.

Write a PL/SQL Program to display the department number, department name, location and number of employees. The department which is having more than three employees.
    
SQL>DECLARE
    CURSOR cs is
    SELECT d.deptno,d.dname,d.loc,v.noe
    FROM dept d,(SELECT deptno,count(*) noe
            FROM emp
    Group by deptno) v
    WHERE  v.noe>3 AND
    d.deptno=v.deptno;
    BEGIN
    FOR  i in cs
    LOOP
  display(i.deptno||’ ‘||i.dname||’ ‘||i.loc||’ ‘||i.noe);
    END LOOP;
    END; 

 Click here to go to Back page

No comments:

Post a Comment