Dbms 8
Dbms 8
8: EXECUTE QUERIES
USING SELECT COMMAND WITH WHERE, HAVING,
GROUP BY AND ORDE BY CLAUSE.
OUTPUT:
1 row(s) inserted
Q1]
A] select deptno, sum(salary) from Emp e, Dept d where e.empno=d.empno group by
deptno;
DEPTNO SUM(SALARY)
20 57000
10 170000
EMPNO DEPTNO
2 20
4 20
1 10
3 10
C) select min(salary) from Emp e, Dept d where e.empno=d.empno group by deptno;
MIN(SALARY)
7000
80000
EMPNO JOBTYPE
4 professor
1 HOD
3 professor
2 HOD
Q2]
MIN(SALARY)
7000
80000
B]
DEPTNAME SUM(SALARY)
Civil 57000
Comp 170000
C] select deptname from Dept where deptname in (select deptname from Dept group
by deptname having count (*) >2)
DEPTNAME
Civil
Civil
Civil
OUTPUT:
1 row(s) inserted
A]selectdeptname,
sum(salary) from
Emp e, Dept d
where
e.empno=d.empno
group by
deptname;
DEPTNAME SUM(SALARY)
Civil 197000
Comp 170000
DEPTNAME MIN(SALARY)
Civil 7000
Comp 80000
C] select deptname, count(emp.empno) from Dept,Emp where Dept.empno=Emp.empno
group by deptname
DEPTNAME COUNT(EMP.EMPNO)
Civil 3
Comp 2
DEPTNAME COUNT(EMP.EMPNO)
Civil 2
Comp 2
COUNT(*)
3