Sunteți pe pagina 1din 2

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.

20. 21. 22. 23. 24.

Select ename from emp where job=Analyst or job=Salesman; Select * from emp where hiredate<30-SEP-81; Select ename from emp where job!=Manager; Select ename Name Of Employees where empno in(7369,7521,7839,7934,7788); Select ename where deptno not in(30,40,10); Select ename List of Employees from emp where hiredate between30-JUN-81 and 31DEC-81; Select ename Employee Names from emp where hiredate like %JAN%; Select ename 20 Years Old Employees from emp where (sysdate-hiredate)>20*365; Select distinct job Job Type from emp; Select ename Name Of Commission Getter from emp where comm>0; Select distinct a.ename Supervisor from emp a,emp b where a.empno=b.mgr; Select a.ename from emp a,dept b where a.deptno=b.deptno and b.loc=Boston; Select ename name from emp where ename likeS% or ename like %s; Select ename name from emp where ename like _i; Select count(empno) No of Employee from emp a,dept b where a.deptno(+)=b.deptno and b.dname=Operation; Select max(sal),min(sal),avg(sal)from emp; Select ename name,sal from emp where sal>(select avg(sal) from emp); Select b.ename employee,a.ename Supervisor from emp b,emp a where a.empno=b.mgr and a.hiredate>b.hiredate; Select distinct c.ename,c.hiredate from(select m.ename,m.hiredate from emp e,emp m where c.hiredate=(select min(c.hiredate) from (select m.ename,m.hiredate from emp e,emp m where m.empno=e.mgr)c); Select count(empno)No of Employee,avg(sal)Avarage Salfrom emp where deptno=20; Select ename,sal,(10*sal)/100 PF from emp; Select * from emp order by sal; Select ename name,hiredate from emp order by hiredate desc; Select ename,sal,(10*sal)/100PF,(50*sal)/100 HRA,(30*sal)/100 DA,((90*sal)/100+sal)gross from emp; a)alter table emp add gross number(10,2); b)update emp set gross=(90*sal)/100+sal) where comm<sal; c)commit;

25. select b.deptno,count(empno)No of Employeefrom emp a,dept b where a.deptno(+)=b.deptno group by b.deptno; 26. select b.deptno,sum(sal) from emp a,dept b where a.deptno(+)=b.deptno group by b.deptno; 27. Select job,count(empno)No of Employees from emp group by job order by count(empno)desc; 28.select job,sum(gross) total,max(gross),min(gross) from emp group by job; 29. select job,sum(gross) total,max(gross),avg(gross) from emp where deptno=20 group by job; 30. Select a.ename employee,a.gross salary,b.enamesupervisor,b.gross salary from emp a,emp b where b.empno=a.mgr;

31.select ename from emp where mgr is null;

S-ar putea să vă placă și