블로그 이미지
꿈을 꾸는 꾸러기 YBHoon

카테고리

분류 전체보기 (81)
Oracle (71)
운영체제 (7)
ETC (0)
Study (3)
Total
Today
Yesterday

달력

« » 2025.6
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

공지사항

태그목록

최근에 올라온 글

SQL 그룹함수

Oracle/SQL & PL/SQL / 2010. 2. 10. 11:43

1.
SQL> select deptno, avg(weight), count(*)
from student
group by deptno
order by avg(weight) desc;

2.
SQL> select max(count(*)), min(count(*))
from student
group by grade;

3.
SQL> select deptno, grade, count(*), max(weight)
from student
group by deptno, grade
having count(*) >= 3;

4.
SQL> select deptno, grade, avg(height)
from student
group by cube(deptno, grade);

5.
SQL> select deptno, grade, avg(weight)
from student
group by rollup(deptno, grade);

6.
SQL> select deptno, count(*)
from professor
group by deptno
having count(*) <=2;

7.
SQL> select max(sal+nvl(comm,0)),
min(sal+nvl(comm,0)),
round(avg(sal+nvl(comm,0)),1)
from professor;

8.
SQL> select deptno, position, avg(sal)
from professor
group by cube(deptno, position);

9.
SQL> select position
case when avg(sal)>=300 then'우수'
else '보통'
end '구분'
from professor
group by position;

'Oracle > SQL & PL/SQL' 카테고리의 다른 글

JOIN (oracle JOIN) - 연습문제  (0) 2010.02.11
JOIN (oracle JOIN)  (0) 2010.02.10
SQL 함수 - 연습문제  (0) 2010.02.09
SQL 함수  (1) 2010.02.09
SQL 연산 기초  (1) 2010.02.08
Posted by YBHoon
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함