본문 바로가기
개발/sql

oracel sql

by 카앙구운 2015. 9. 23.
728x90
반응형

select *from emp where rownum <=5;


select * from emp order by sal desc;


select *from emp where job='MANAGER' and comm is not null and comm!='';


select ename,to_char(hiredate,'YYYY') from emp;


select ename from emp where substr(hiredate,0,2)=80;


select count(*) 인원수,deptno 부서번호 from emp group by deptno;


select ename from (select rownum rm,ename from emp order by sal desc) where rownum<=5;


select * from( select rownum,rm,ename,sal from (select ename,sal from emp order by sal desc)) where rm between 5 and 10;


select ename from emp where ename like 'S#_%' escape #;


select round(avg(sal),0),deptno from emp group by deptno;


select (select dname from dept where deptno=e.deptno) || '의 급여평균은'||round(avg(sal),2)||'입니다' as 부서평균 from emp e group by deptno;

728x90
반응형

댓글