카테고리 없음

학과별로 인원수 내는 코드 생능출판사 오라클

bo97037 2014. 12. 17. 12:07

drop table jutice_student;

create  table jutice_student
as select d.deptno, min(dname),(select  count(s.name)
from student s 
where d.DEPTNO=S.DEPTNO1) "count",
(select count(p.name)
from  professor p 
where (d.DEPTNO=p.DEPTNO)
) "count1"
from department d group by d.deptno;


**전자 -> 영업1팀 2300 10명

**반도체 -> 영업1팀 2401 30명


select d.deptno,
    (select count(p.name)
    from  professor p 
    where (d.DEPTNO=p.DEPTNO) ) "count1"
from department d
group by d.deptno;

 

select * from jutice_student;