Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 31

What is a Test Case?

A test case is a noted/documented set of steps/activities that are carried out or executed on the software in order to confirm its functionality/behavior to certain set of inputs.

Tel me Defect Life cycle or How will you report defect in your organisation?

Depends on organization and project. 1. By using some defect Track Tools like quality Center,Bugzilla,Clear Quest Etc.. ( These tools I know but we are using Service Desk internal tool) . By using some internal tools.

3. By using Excel sheet also we can report the bug.


!n our project "#en e$er i got a de$iation from t#e requirements %#ile e&ecuting t#e application t#en i %ill make sure t#at t#e defect is reproduci'le and t#en i %ill post t#e defect using t#e 'ugtracking tool (service desk ) 'y keeping t#e status of t#e 'ug as ne%.

Right from the first time any bug is detected till the point when the bug is fixed and closed, it is assigned various statuses which are New, Open, ssigned to development, development completed, !ending Re"ect, Re"ect, #eferred, and Closed$

What is sanity testing? Or Smoke Testing?


(anity testing is done %#ene$er t#e ne% 'uild release )like Test instance and stage instance *. %e #a$e to test for t#e major functionality of t#e application %#ic# could stop our testing part continuation.!f it fails, t#en %e s#ould not continue %it# our testing part. +or t#e eg of telep#one, !f %e c#eck t#e functionality like %#ile lifting t#e recei$er, it s#ould gi$e t#e dial tone. if it fails, t#en its %aste of time to continue %it# t#e testing p#ase. ,lso called as smoke testing.

What is Regression Testing?


-egression Testing means to test t#e entire application to ensure t#at t#e fi&ing of 'ug %ill 'e affecting any%#ere else in t#e application (. %e %ill take some test cases %#ic# is major functionality is reflecting.

How to write Test Cases? What r the items in the Test Case? How to say whether the Test Case co ers all functionalities in !pplication?
Test Cases are %ritten t#e requirements gi$en 'y t#e Cust and realted to use of soft%are)to some e&tent*.Test Cases s#ould or say /ust co$er all t#e t#ings gi$en 'y t#e Client in B-D0+-D. Test Cases Contains1 Test case !D

Desc !nput E&pected -esult ,ctual -esult (tatus )2ass0+ailed* Comments

S"L#"$%R&%S 1. Display all the information of the EMP table? A select ! from emp" #. Display uni$ue %obs from EMP table? & select 'istinct (ob from emp" 1 select uni$ue (ob from emp" # 3. )ist the emps in the asc or'er of their *alaries? A select ! from emp or'er by sal asc" +. )ist the 'etails of the emps in asc or'er of the Dptnos an' 'esc of %obs? A select ! from emp or'er by 'eptno asc,(ob 'esc" -. Display all the uni$ue (ob groups in the 'escen'ing or'er? A select 'istinct (ob from emp or'er by (ob 'esc" .. Display all the 'etails of all /Mgrs0 A *elect ! from emp where empno in 1 select mgr from emp " 2. )ist the emps who (oine' before 1341. A select ! from emp where hire'ate 5 10&16(an6410 " 4. )ist the Empno, Ename, *al, Daily sal of all emps in the asc or'er of Annsal. A select empno ,ename ,sal,sal73&,1#!sal annsal from emp or'er by annsal asc" 1. Display the Empno, Ename, (ob, 8ire'ate, Exp of all Mgrs A select empno,ename ,(ob,hire'ate, months9between1sys'ate,hire'ate exp from emp where empno in 1select mgr from emp " )ist the Empno, Ename, *al, Exp of all emps wor:ing for Mgr 23.3. A select empno,ename,sal,exp from emp where mgr ; 23.3" Display all the 'etails of the emps whose <omm. =s more than their *al. A select ! from emp where comm. > sal" )ist the emps in the asc or'er of Designations of those (oine' after the secon' half of 1341. A select ! from emp where hire'ate > 103&6(un6410 an' to9char1hire'ate,0????0 ; 1341 or'er by (ob asc" 1. )ist the emps along with their Exp an' Daily *al is more than @s.1&&. A select ! from emp where 1sal73& >1&&" )ist the emps who are either /<)E@A0 or /ABA)?*C0 in the Desc or'er. A select ! from emp where (ob ; /<)E@A0 or (ob ; /ABA)?*C0 or'er by (ob 'esc"

1. )ist the emps who (oine' on 16MA?641,36DE<641,126DE<641,136%AB64& in asc or'er of seniority. A select ! from emp where hire'ate in 10&16may6410,0&36'ec6410,0126'ec6410,0136(an64&0 or'er by hire'ate asc" 1.. )ist the emp who are wor:ing for the Deptno 1& or#&. A select ! from emp where 'eptno ; 1& or 'eptno ; #& " 12. )ist the emps who are (oine' in the year 41. A select ! from emp where hire'ate between 0&16(an6410 an' 0316'ec6410" 14. )ist the emps who are (oine' in the month of Aug 134&. .1 select ! from emp where hire'ate between 0&16aug64&0 an' 0316aug64&0" 1D@ .# select ! from emp where to9char1hire'ate,0mon6yyyy0 ;0aug6134&" .3 13. )ist the emps Eho Annual sal ranging from ##&&& an' +-&&&. A select ! from emp where 1#!sal between ##&&& an' +-&&&" #&. )ist the Enames those are haFing fiFe characters in their Bames. A select ename from emp where length 1ename ; -" #1. )ist the Enames those are starting with /*0 an' with fiFe characters. A select ename from emp where ename li:e /*G0 an' length 1ename ; -" ##. )ist the emps those are haFing four chars an' thir' character must be /r0. A select ! from emp where length1ename ; + an' ename li:e /99@G0" #3. )ist the HiFe character names starting with /*0 an' en'ing with /80. A select ! from emp where length1ename ; - an' ename li:e /*G80" #+. )ist the emps who (oine' in %anuary. A select ! from emp where to9char 1hire'ate,0mon0 ; /(an0" #-. )ist the emps who (oine' in the month of which secon' character is /a0. .+ select ! from emp where to9char1hire'ate,0mon0 li:e /9a90" 1D@ B select ! from emp where to9char1hire'ate,0mon0 li:e /9aG0" 1. )ist the emps whose *al is four 'igit number en'ing with Iero. A select ! from emp where length 1sal ; + an' sal li:e /G&0" )ist the emps whose names haFing a character set /ll0 together. A select ! from emp where ename li:e /G))G0"

#4. )ist the emps those who (oine' in 4&0s. A select ! from emp where to9char1hire'ate,0yy0 li:e /4G0" #3. )ist the emps who 'oes not belong to Deptno #&. A select ! from emp where 'eptno not in 1#& " 1D@ B select ! from emp where 'eptno J; #&" 1D@ < select ! from emp where 'eptno 5>#&" 1D@ D select ! from emp where 'eptno not li:e /#&0" 3&. )ist all the emps except /P@E*=DEBC0 K /ML@M in asc or'er of *alaries. & *elect ! from emp where (ob not in 1/P@E*=DEBC0,0MABALE@0 or'er by sal asc" 1 select ! from emp where (ob not li:e /P@E*=DEBC0 an' (ob not li:e /MABALE@0 or'er by sal asc" < *elect ! from emp where (ob J; /P@E*=DEBC0 an' (ob 5> /MABALE@0 or'er by sal asc" 31. )ist all the emps who (oine' before or after 1341. & select ! from emp where to9char 1hire'ate,0????0 not in 1/13410 " 1D@ 1 select ! from emp where to9char 1 hire'ate,0????0 J; /13410" 1D@ # select ! from emp where to9char1hire'ate,0????0 5> /13410 " 1D@ D select ! from emp where to9char 1hire'ate ,0????0 not li:e /13410" 1. )ist the emps whose Empno not starting with 'igit24. A select ! from emp where empno not li:e /24G0" )ist the emps who are wor:ing un'er /ML@0. A select e.ename NN / wor:s for / NN m.ename from emp e ,emp m where e.mgr ; m.empno " 1D@ B select e.ename NN / has an employee /NN m.ename from emp e , emp m where e.empno ; m.mgr"

3+. )ist the emps who (oine' in any year but not belongs to the month of March. .1 select ! from emp where to9char 1hire'ate,0MDB0 not in 1/MA@0 " 1D@ .# select ! from emp where to9char 1hire'ate,0MDB0 J; /MA@0" 1D@ .3 select ! from emp where to9char1hire'ate,0MDBC80 not li:e /MA@G0 " 1D@ .+ select ! from emp where to9char1hire'ate,0MDB0 5> /MA@0" .3-. )ist all the <ler:s of Deptno #&. A select ! from emp where (ob ;/<)E@A0 an' 'eptno ; #&" 3.. )ist the emps of Deptno 3& or 1& (oine' in the year 1341. A select ! from emp where to9char1hire'ate,0????0 ; /13410 an' 1'eptno ;3& or 'eptno ;1& " 1D@ select ! from emp where to9char 1hire'ate,0????0 in 1/13410 an' 1'eptno ; 3& or 'eptno ;1& " 32. Display the 'etails of *M=C8. A select ! from emp where ename ; /*M=C80 " 34. Display the location of *M=C8. A select loc from emp e , 'ept ' where e.ename ; /*M=C80 an' e.'eptno ; '.'eptno " 33. )ist the total information of EMP table along with DBAME an' )oc of all the emps Eor:ing On'er /A<<DOBC=BL0 K /@E*EA@<80 in the asc Deptno. .. select ! from emp e ,'ept ' where 1'name ; /A<<DOBC=BL0 or 'name ;0@E*EA@<80 an' e.'eptno ; '.'eptno or'er by e.'eptno asc" 1D@ .2 select ! from emp e ,'ept ' where '.'name in 1/A<<DOBC=BL0,0@E*EA@<80 an' e.'eptno ; '.'eptno or'er by e.'eptno asc" .1 )ist the Empno, Ename, *al, Dname of all the /ML@*0 an' /ABA)?*C0 wor:ing in Bew ?or:, Dallas with an exp more than 2 years without receiFing the <omm asc or'er of )oc. .# select e.empno,e.ename,e.sal,'.'name from emp e ,'ept ' where '.loc in 1/BEE ?D@A0,0DA))A*0 an' e.'eptno ; '.'eptno an' e.empno in 1select e.empno from emp e where e.(ob in 1/MABALE@0,0ABA)?*C0 an' 1months9between1sys'ate,e.hire'ate 71# > 2 an' e.comm. is null or'er by '.loc asc"

1. Display the Empno, Ename, *al, Dname, )oc, Deptno, %ob of all emps wor:ing at <%=<ALD or wor:ing for A<<DOBC=BL 'ept with Ann *al>#4&&&, but the *al shoul' not be;3&&& or #4&& who 'oesn0t belongs to the Mgr an' whose no is haFing a 'igit /20 or /40 in 3r' position in the asc or'er of Deptno an' 'esc or'er of (ob. A select E.empno,E.ename,E.sal,D.'name,D.loc,E.'eptno,E.(ob from emp E,'ept D where 1D.loc ; P<8=<ALDP or D.'name ; PA<<DOBC=BLP an' E.'eptno;D.'eptno an' E.empno in 1select E.empno from emp E where 11#!E.sal > #4&&& an' E.sal not in 13&&&,#4&& an' E.(ob J;PMABALE@P an' 1 E.empno li:e P992GP or E.empno li:e P994GP or'er by E.'eptno asc , E.(ob 'esc"
1. Display the total information of the emps along with Lra'es in the asc or'er. A select ! from emp e ,salgra'e s where e.sal between s.losal an' s.hisal or'er by gra'e asc" 1D@ B select ! from emp e ,salgra'e s where e.sal >; s.losal an' e.sal 5; s.hisal or'er by s.gra'e asc" 1using between an' is a bit simple +3. )ist all the Lra'e# an' Lra'e 3 emps. & select ! from emp e where e.empno in 1select e.empno from emp e ,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in1#,3 " 1D@ B select ! from emp e ,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in 1#,3 " 1. Display all Lra'e +,- Analyst an' Mgr. A select ! from emp e, salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in 1+,an' e.empno in 1select e.empno from emp e where e.(ob in 1/MABALE@0,0ABA)?*C0 "

1. )ist the Empno, Ename, *al, Dname, Lra'e, Exp, an' Ann *al of emps wor:ing for Dept1& or#&. A selectE.empno,E.ename,E.sal,*.gra'e,D.'name,1months9between1sys'ate,E.hire'ate 71# QERPQ ,1#!E.sal SABB *A)M from emp E,'ept D ,salgra'e * where E.'eptno in 11&,#& an' E.'eptno ; D.'eptno an' E.sal between *.losal an' *.hisal " 1. )ist all the information of emp with )oc an' the Lra'e of all the emps belong to the Lra'e range from # to + wor:ing at the Dept those are not starting with char set /DP0 an' not en'ing with /*0 with the 'esignation haFing a char /a0 any where (oine' in the year 1341 but not in the month of Mar or *ep an' *al not en' with /&&0 in the asc or'er of Lra'es A select e.empno,e.ename,'.loc,s.gra'e,e.sal from emp e ,'ept ',salgra'e s where e.'eptno ; '.'eptno an' 1'.'name not li:e PDPGP an' '.'name not li:e PG*P an' e.sal between s.losal an' s.hisal an' s.gra'e in 1#,3,+ an' empno in 1select empno from emp where (ob li:e PGAGPan' sal not li:e PG&&P an' 1to9char 1hire'ate,P????P ; P1341P an' to9char1hire'ate,PMDBP not in 1PMA@P,P*EPP " 1. )ist the 'etails of the Depts along with Empno, Ename or without the emps

A select ! from emp e,'ept ' where e.'eptno1T ; '.'eptno" +4. )ist the 'etails of the emps whose *alaries more than the employee B)AAE. A select ! from emp where sal > 1select sal from emp where ename ; /B)AAE0 " +3. )ist the emps whose %obs are same as A))EB. A select ! from emp where (ob ; 1select (ob from emp where ename ; /A))EB0 " -&. )ist the emps who are senior to Aing. & select ! from emp where hire'ate 5 1 select hire'ate from emp where ename ; /A=BL0 "

-1. )ist the Emps who are senior to their own ML@*. .1 select ! from emp w,emp m where w.mgr ; m.empno an' w.hire'ate 5 m.hire'ate " 1D@ .# select ! from emp w,emp m where w.empno; m.mgr an' w.hire'ate> m.hire'ate" -#. )ist the Emps of Deptno #& whose %obs are same as Deptno1&. A select ! from emp e ,'ept ' where '.'eptno ; #& an' e.'eptno ; '.'eptno an' e.(ob in 1 select e.(ob from emp e,'ept ' where e.'eptno ; '.'eptno an' '.'eptno ;1& " -3. )ist the Emps whose *al is same as HD@D or *M=C8 in 'esc or'er of *al. A *elect ! from emp where sal in 1select sal from emp where 1 ename ; /*M=C80 or ename ; /HD@D0 or'er by sal 'esc" -+. )ist the emps Ehose %obs are same as M=))E@ or *al is more than A))EB. A select ! from emp where (ob ; 1select (ob from emp where ename ; /M=))E@0 or sal>1select sal from emp where ename ; /A))EB0 " --. )ist the Emps whose *al is > the total remuneration of the *A)E*MAB. A select ! from emp where sal >1select sum1nFl#1comm,salTcomm,sal from emp where (ob ; /*A)E*MAB0 " -.. )ist the emps who are senior to B)AAE wor:ing at <8=<ALD K BD*CDB. .3 select ! from emp e ,'ept ' where '.loc in 1/<8=<ALD0,0BD*CDB0 an' e.'eptno ; '.'eptno an' e.hire'ate 51select e.hire'ate from emp e where e.ename ; /B)AAE0 "

-2. )ist the Emps of Lra'e 3,+ belongs to the 'ept A<<DOBC=BL an' @E*EA@<8 whose *al is more than A))EB an' exp more than *M=C8 in the asc or'er of ERP. & select ! from emp e where e.'eptno in 1select '.'eptno from 'ept ' where '.'name in 1/A<<DOBC=BL0,0@E*EA@<80 an' 1 e.sal >1select sal from emp where ename ; /A))EB0 an' e.hire'ate 51 select hire'ate from emp where ename ; /*M=C80 an' e.empno in 1select e.empno from emp e ,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in 13,+ or'er by e.hire'ate 'esc" -4. )ist the emps whose (obs same as *M=C8 or A))EB. & select ! from emp where (ob in 1select (ob from emp where ename ; /*M=C80 or ename ; /A))EB0 " 1D@ B select ! from emp where (ob in 1select (ob from emp where ename in 1/*M=C80,0A))EB0 " -3. Erite a Uuery to 'isplay the 'etails of emps whose *al is same as of & Employee *al of EMP1 table. 1 V *al of any Mgr of EMP# table. # Che sal of any person with exp of - years belongs to the sales 'ept of emp3 table. 3 Any gra'e # employee of emp+ table. + Any gra'e # an' 3 employee wor:ing fro sales 'ept or operations 'ept (oine' in 43. .&. Any (obs of 'eptno 1& those that are not foun' in 'eptno #&. A select e.(ob from emp e where e.'eptno ; 1& an' e.(ob not in 1select (ob from emp where 'eptno ;#& " .1. )ist of emps of emp1 who are not foun' in emp#. .#. Hin' the highest sal of EMP table. A select max1sal from emp" .3. Hin' 'etails of highest pai' employee. & select ! from emp where sal in 1select max1sal from emp "

1. Hin' the highest pai' employee of sales 'epartment. A select ! from emp where sal in 1select max1sal from emp where 'eptno in 1select '.'eptno from 'ept ' where '.'name ; P*A)E*P " )ist the most recently hire' emp of gra'e3 belongs to location <8=<ALD. A select ! from emp e where e.'eptno in 1 select '.'eptno from 'ept ' where '.loc ; P<8=<ALDP an' e.hire'ate in 1select max1hire'ate from emp where empno in 1select empno from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e ; 3 " 1or select ! from emp e,'ept ' where '.loc;PchicagoP an' hire'ate in1select max1hire'ate from emp e,salgra'e s where sal between losal an' hisal an' gra'e;3 " )ist the employees who are senior to most recently hire' employee wor:ing un'er :ing. A select ! from emp where hire'ate 5 1select max1hire'ate from emp where mgr in 1select empno from emp where ename ; PA=BLP " )ist the 'etails of the employee belongs to newyor: with gra'e 3 to - except /P@E*=DEBC0 whose sal> the highest pai' employee of <hicago in a group where there is manager an' salesman not wor:ing un'er :ing A select ! from emp where 'eptno in 1select 'eptno from 'ept where 'ept.loc ;PBEE ?D@AP an' empno in 1select empno from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in 13,+,an' (ob J; PP@E*=DEBCP an' sal >1select max1sal from emp where 'eptno in 1select 'eptno from 'ept where 'ept.loc ; P<8=<ALDP an' (ob in 1PMABALE@P,P*A)E*MABP an' mgr not in 1select empno from emp where ename ; PA=BLP " 1. )ist the 'etails of the senior employee belongs to 1341.

.1 select ! from emp where hire'ate in 1select min1hire'ate from emp where to9char1 hire'ate,0????0 ; /13410 " 1D@

.1 select ! from emp where hire'ate ; 1select min1hire'ate from emp where to9char1hire'ate,0????0 ; /13410 " 1. )ist the employees who (oine' in 1341 with the (ob same as the most senior person of the year 1341. A select ! from emp where (ob in 1select (ob from emp where hire'ate in 1select min1hire'ate from emp where to9char1hire'ate,0????0 ;013410 " 1. )ist the most senior empl wor:ing un'er the :ing an' gra'e is more than 3. A select ! from emp where hire'ate in 1select min1hire'ate from emp where empno in 1select empno from emp e ,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in 1+,an' mgr in 1select empno from emp where ename ; PA=BLP " 21. Hin' the total sal giFen to the ML@. & select sum 1sal from emp where (ob ; /MABALE@0" 1D@ B select sum1sal from emp where empno in1select mgr from emp " 1. Hin' the total annual sal to 'istribute (ob wise in the year 41. A select (ob,sum11#!sal from emp where to9char1hire'ate,P????P ; P1341P group by (ob " 23. Display total sal employee belonging to gra'e 3. & select sum1sal from emp where empno 1 in 1select empno from emp e ,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e ; 3 1. Display the aFerage salaries of all the cler:s. A select aFg1sal from emp where (ob ; /<)E@A0" 1. )ist the employeein 'ept #& whose sal is >the aFerage sal &f 'ept 1& emps. A select ! from emp where 'eptno ;#& an' sal >1select aFg 1sal from emp where 'eptno ; 1& " 2.. Display the number of employee for each (ob group 'eptno wise. & select 'eptno ,(ob ,count1! from emp group by 'eptno,(ob" 1or B select '.'eptno,e.(ob,count1e.(ob from emp e,'ept ' where e.'eptno1T ;'.'eptno group by e.(ob,'.'eptno"

22. )ist the manage rno an' the number of employees wor:ing for those mgrs in the ascen'ing Mgrno. & select w.mgr ,count1! from emp w,emp m 1 where w.mgr ; m.empno group by w.mgr or'er by w.mgr asc" 24. )ist the 'epartment,'etails where at least two emps are wor:ing & select 'eptno ,count1! from emp group by 'eptno 1 haFing count1! >; #" 1. Display the Lra'e, Bumber of emps, an' max sal of each gra'e. A select s.gra'e ,count1! ,max1sal from emp e,salgra'e s where e.sal between s.losal an' s.hisal group by s.gra'e" 4&. Display 'name, gra'e, Bo. of emps where at least two emps are cler:s. A select '.'name,s.gra'e,count1! from emp e,'ept ',salgra'e s where e.'eptno ; '.'eptno an' e.(ob ; P<)E@AP an' e.sal between s.losal an' s.hisal group by '.'name,s.gra'e haFing count1! >; #" 41. )ist the 'etails of the 'epartment where maximum number of emps are wor:ing. .1 select ! from 'ept where 'eptno in .# 1select 'eptno from emp group by 'eptno haFing count1! in 1select max1count1! from emp group by 'eptno " 1D@ .3 select '.'eptno,'.'name,'.loc,count1! from emp e ,'ept ' where e.'eptno ; '.'eptno group by '.'eptno,'.'name,'..loc haFing count1! ; 1select max1count1! from emp group by 'eptno " 4#. Display the emps whose manager name is (ones. .1 select ! from emp where mgr in .# 1select empno from emp where ename ; /%DBE*0 " 1D@ .3 select ! from emp where mgr ; .+ 1select empno from emp where ename ; /%DBE*0 " 43. )ist the employees whose salary is more than 3&&& after giFing #&G increment. & *E)E<C ! H@DM EMP E8E@E 11.#!*A) > 3&&& " 1. )ist the emps with 'ept names. A select e.empno,e.ename,e.(ob,e.mgr,e.hire'ate,e.sal,e.comm,e.'eptno,'.'name from emp e ,'ept ' where e.'eptno ; '.'eptno" 1. )ist the emps who are not wor:ing in sales 'ept.

.1

select ! from emp where 'eptno not in

1select 'eptno from emp where 'name ; /*A)E*0 " 1. )ist the emps name ,'ept, sal an' comm. Hor those whose salary is between #&&& an' -&&& while loc is <hicago. A select e.ename,e.'eptno,e.sal,e.comm from emp e ,'ept ' where e.'eptno ; '.'eptno an' '.loc ; P<8=<ALDP an' e.sal between #&&& an' -&&&" )ist the emps whose sal is greater than his managers salary A select ! from emp w,emp m where w.mgr ; m.empno an' w.sal > m.sal" 1. )ist the gra'e, EMP name for the 'eptno 1& or 'eptno 3& but sal gra'e is not + while they (oine' the company before 0316'ec64#0. A select s.gra'e ,e.ename from emp e,salgra'e s where e.'eptno in 11&,#& an' hire'ate 5 1P316DE<64#P an' 1e.sal between s.losal an' s.hisal an' s.gra'e not in 1+ " 43. )ist the name ,(ob, 'name, location for those who are wor:ing as ML@*. & select e.ename,e.(ob,'.'name,'.loc from emp e ,'ept ' 1 where e.'eptno ; '.'eptno an' e.empno in 1select mgr from emp " 1. )ist the emps whose mgr name is (ones an' also list their manager name. A select w.empno,w.ename,w.(ob,w.mgr,w.hire'ate,w.sal,w.'eptno,m.ename from emp w ,emp m where w.mgr ; m.empno an' m.ename ; P%DBE*P" 1. )ist the name an' salary of for' if his salary is e$ual to hisal of his gra'e. A select e.ename,e.sal from emp e ,salgra'e s where e.ename ; PHD@DP an' e.sal between s.losal an' s.hisal an' e.sal ; s.hisal " 3#. )it the name, (ob, 'name ,sal, gra'e 'ept wise & select e.ename,e.(ob,'.'name,e.sal,s.gra'e from emp e,'ept ',salgra'e s 1 where e.'eptno ; '.'eptno an' e.sal between s.losal an' s.hisal or'er by e.'eptno " 1. )ist the emp name, (ob, sal, gra'e an' 'name except cler:s an' sort on the basis of highest sal.

& select e.ename,e.(ob,e.sal,s.gra'e,'.'name from emp e ,'ept ' ,salgra'e s where e.'eptno ; '.'eptno an' e.sal between s.losal an' s.hisal an' 1 e.(ob not in1P<)E@AP or'er by e.sal 'esc" 1. )ist the emps name, (ob who are with out manager. A select e.ename,e.(ob from emp e where mgr is null" 3-. )ist the names of the emps who are getting the highest sal 'ept wise. & select e.ename,e.'eptno from emp e where e.sal in 1 1select max1sal from emp group by 'eptno " 1. )ist the emps whose sal is e$ual to the aFerage of max an' minimum A select ! from emp where sal ;1select 1max1sal Tmin1sal 7# from emp " 1. )ist the no. of emps in each 'epartment where the no. is more than 3.

A select 'eptno,count1! from emp group by 'eptno haFing count1! 5 3" 34. )ist the names of 'epts. Ehere atleast 3 are wor:ing in that 'epartment. .1 select '.'name,count1! from emp e ,'ept ' where e.'eptno ; '.'eptno .# group by '.'name haFing count1! >; 3 " 33. )ist the managers whose sal is more than his employess aFg salary. .3 select ! from emp m where m.empno in 1select mgr from emp an' m.sal > 1select aFg1e.sal from emp e wheree.mgr ; m.empno Che sub$uery 'oes the same as 1 1&&. )ist the name,salary,comm. Hor those employees whose net pay is greater than or e$ual to any other employee salary of the company. & select e.ename,e.sal,e.comm from emp e where nFl#1e.comm.,e.salTe.comm.,e.sal >; any 1select sal from emp " 1D@ 1 select ename,sal,comm. from emp where salTnFl1comm.,& >; any 1select sal from emp "7 1. )ist the emp whose sal5his manager but more than any other manager. a select 'istinct E.empno,E.ename,E.sal from 1select w.empno,w.ename,w.sal from emp w,emp m where w.mgr ; m.empno an' w.sal5m.sal E, 1select ! from emp where empno in 1select mgr from emp A

where E.sal > A.sal" 1D@ B select ! from emp w,emp m where w.mgr ; m.empno an' w.sal 5 m.sal an' w.sal > any 1select sal from emp where empno in 1select mgr from emp " 1&#. )ist the employee names an' his aFerage salary 'epartment wise. A select '.'eptno, roun'1aFg1nFl#1e1.comm, e1.salTe1.comm, e1.sal aFg, e#.ename from emp e1, emp e#, 'ept ' where '.'eptno ;e1.'eptno an' '.'eptno ; e#.'eptno group by '.'eptno, e#.ename" 1or B select '.maxsal,e.ename,e.'eptno as Qcurrent salQ from emp e, 1select aFg1*al maxsal,'eptno from emp group by 'eptno ' where e.'eptno;'.'eptno" 1&3. Hin' out least - earners of the company. A select ! from emp e where -> 1select count1! from emp where e.sal >sal " 1or & select rownum ran:,empno,ename,(ob,sal from 1select ! from emp or'er by sal asc where rownum 5 . " 1or 1 select ! from emp e where - >1select count1'istinct sal from emp where e.sal > sal " 1&+. Hin' out emps whose salaries greater than salaries of their managers. A select ! from emp w,emp m where w.mgr ; m.empno an' w.sal> m.sal" 1D@ B select ! from emp e ,1select ! from emp where empno in 1select mgr from emp a where e.sal >a.sal an' e.mgr ; a.empno 1&-. )ist the managers who are not wor:ing un'er the presi'ent. A select ! from emp where empno in1select mgr from emp an' mgr not in 1select empno from emp where (ob ; PP@E*=DEBCP 1&.. )ist the recor's from emp whose 'eptno isnot in 'ept.

1&2. )ist the Bame , *alary, <omm an' Bet Pay is more than any other employee. A *elect e.ename,e.sal,e.comm,nFl#1comm,salTcomm,sal BECPA? from emp e where nFl#1comm,salTcomm,sal > any 1select sal from emp where empno ;e.empno " 1&4. )ist the Enames who are retiring after 316Dec643 the max %ob perio' is #&?. .1 elect ename from emp where a''9months1hire'ate,#+& > P316DE<643P" B select ename from emp where a''9months1hire'ate,#+& > to9'ate10316DE<6430,0DD6MDB6@@0 " 1&3. )ist those Emps whose *alary is o'' Falue. .1 elect ! from emp where mo'1sal,# ; 1" 11&. )ist the emp0s whose *alary contain 3 'igits. elect ! from emp where length 1sal ; 3" 111. )ist the emps who (oine' in the month of DE<. A select ! from emp where to9char1hire'ate,0MDB0 ;0DE<0" 1D@ B select ! from emp where to9char1hire'ate,0MDB0 in 1/DE<0 " 1D@ < select ! from emp where to9char1hire'ate,0MDBC80 li:e /DE<G0" 11#. )ist the emps whose names contains /A0. A select ! from emp where ename li:e /GAG0" 113. )ist the emps whose Deptno is aFailable in his *alary. A select ! from emp where instr1sal,'eptno > &" 11+. )ist the emps whose first # chars from 8ire'ate;last # characters of *alary. A select ! from emp where substr1hire'ate,1,# ; substr1sal,length1sal 61,length1sal " 11-. )ist the emps Ehose 1&G of *alary is e$ual to year of (oining. A select ! from emp where to9char1hire'ate,P??P in 1select .1!sal from emp " 11.. )ist first -&G of chars of Ename in )ower <ase an' remaining are upper <ase. A select lower1substr1ename,1,roun'1length1ename 7# NNsubstr1ename,roun'1length1ename 7# T1,length1ename from emp " 1D@

B select lower1substr1ename,1,ciel1length1ename 7# NN substr1ename,ciel1length1ename 7# T1,length1ename from emp " 112. )ist the Dname whose Bo. of Emps is ;to number of chars in the Dname. A select ! from 'ept ' where length1'name in 1select count1! from emp e where e.'eptno ; '.'eptno " 1or & select '.'name,count1! from emp e ,'ept ' where e.'eptno ; '.'eptno group by '.'name haFing count1! ; length 1'.'name " 114. )ist the emps those who (oine' in company before 1- th of the month. .1 elect ! from emp where to9char1hire'ate,PDDP 5 P1-P" 113. )ist the Dname, no of chars of which is ; no. of emp0s in any other Dept. A select ! from 'ept ' where length1'name in 1select count1! from emp where '.'eptno 5> 'eptno group by 'eptno " 1or B select ! from 'ept where length1'name ; any 1select count1! from emp where '.'eptno 5> 'eptno group by 'eptno " < select ! from 'ept ' , 1select count1! s,e.'eptno QMQfrom emp e group by e.'eptno '1 where length1'name ;'1.s an' '1.M 5>'.'eptno" 1#&. )ist the emps who are wor:ing as Managers. A select ! from where (ob ; /MABALE@0" 1or & select ! from emp where empno in 1select mgr from emp " 1#1. )ist C8E Bame of 'ept where highest no.of emps are wor:ing. A select 'name from 'ept where 'eptno in 1select 'eptno from emp group by 'eptno haFing count1! in 1select max1count1! from emp group by 'eptno " 1##. <ount the Bo.of emps who are wor:ing as /Managers01using set option . .1 lect count1! from1select ! from emp minus select ! from emp where (ob J; PMABALE@P 1#3. )ist the emps who (oine' in the company on the same 'ate. A select ! from emp e where hire'ate in 1select hire'ate from emp where e.empno 5> empno " 1#+. )ist the 'etails of the emps whose Lra'e is e$ual to one tenth of *ales Dept. A select ! from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e ; &.1! 1select 'eptno from 'ept where 'name ; P*A)E*P "

1#-. )ist the name of the 'ept where more than aFerage no. of emps are wor:ing. A select '.'name from 'ept ', emp e where e.'eptno ; '.'eptno group by '.'name haFing count1! > 1select aFg1count1! from emp group by 'eptno " 1#.. )ist the Managers name who is haFing max no.of emps wor:ing un'er him. A select m.ename,count1! from emp w,emp m where w.mgr ; m.empno group by m.ename haFing count1! ; 1select max1count1! from emp group by mgr " 1D@ B select ! from emp where empno ; 1select mgr from emp group by mgr haFing count1! ; 1select max1count1! from emp group by mgr " 1#2. )ist the Ename an' *al is increase' by 1-G an' expresse' as no.of Dollars. A select ename,to9char11.1-!sal,PW33,333P as Q*A)Q from emp" 1only for W it wor:s B select ename,PWPNN1.1-!sal S*A)M from emp" 1#4. Pro'uce the output of EMP table /EMP9ABD9%DB0 for Ename an' %ob. A select enameNN (ob as QEMP9ABD9%DBQ from emp " 1#3. Pro'uce the following output from EMP. '( LO)%% *M=C8 1cler: A))EB 1*alesman A select ename NN /1/NN lower1(ob NN0 0 as SEMP)D?EEM from emp" 13& )ist the emps with 8ire 'ate in format %une +, 1344. A select empno,ename,sal, to9char1hire'ate,PMDBC8 DD,????P from emp" 131 Print a list of emp0s )isting /(ust salary0 if *alary is more than 1-&&, on target if *alary is 1-&& an' /Below 1-&&0 if *alary is less than 1-&&. A select empno,ename,salNN /%O*C *A)A@?0 Q*A)Q from emp where sal > 1-&& union select empno,ename, salNN /DB CA@LEC0 Q*A)Q from emp where sal ; 1-&& union

select empno,ename, salNN /BE)DE 1-&&0 Q*A)Q from emp where sal 5 1-&&" 1D@ B select empno,ename,sal,(ob, case when sal ; 1-&& then PDB CA@LECP when sal 5 1-&& then PBE)DE 1-&&P when sal > 1-&& then P%O*C *A)A@?P else PnothingP en' Q@EX=*ED *A)A@?Q from emp" 13# Erite a $uery which return the 'ay of the wee: for any 'ate entere' in format /DD6 MM6??0. A select to9char1to9'ate1PK sP,P''6mm6yyP ,P'ayP from 'ual " 133 Erite a $uery to calculate the length of serFice of any employee with the company, use DEH=BE to aFoi' repetitiFe typing of functions. A DEH=BE serFice ; 11months9between1sys'ate,hire'ate 71# & *elect empno,ename,KserFice from emp where ename ; /K name0" 13+ LiFe a string of format /BB7BB0, Ferify that the first an' last two characters are numbers an' that the mi''le character is070. Print the expression /?E*0 if Fali', /BD0 if not Fali'. Ose the following Falues to test your solution. /1#73+0,0&171a0, /337340. .1 13- Emps hire' on or before 1- th of any month are pai' on the last Hri'ay of that month those hire' after 1-th are pai' on the first Hri'ay of the following month. Print a list of emps their hire 'ate an' the first pay 'ate. *ort on hire 'ate. .1 elect ename,hire'ate,next9'ay1last9'ay1hire'ate ,PH@=DA?P 62 from emp where to9char1hire'ate,PDDP 5;1union select ename,hire'ate,next9'ay1last9'ay1hire'ate ,PH@=DA?P from emp where to9char1hire'ate,PDDP > 1-" 13. <ount the no. of characters with out consi'ering spaces for each name. A select length1replace1ename,0 /,null from emp" 132 Hin' out the emps who are getting 'ecimal Falue in their *al without using li:e operator. A select ! from emp where instr1sal,0.0,1,1 > &" 134 )ist those emps whose *alary contains first four 'igit of their Deptno.

A select ! from emp where instr1to9char1sal,,3333 ,'eptno,1,1 >& an' instr1to9char1sal,3333 ,'eptno,1,# > & " 133 )ist those Managers who are getting less than his emps *alary. A select 'istinct m.ename,m.sal from emp w,emp m where w.mgr ; m.empno an' w.sal>m.sal" B select ! from emp w where sal 5 any 1 select sal from emp where w.empno;mgr " < select ! from emp w where empno in 1 select mgr from emp where w.sal5sal " 1+& Print the 'etails of all the emps who are sub6or'inates to Bla:e. A select ! from emp where mgr in 1select empno from emp where ename ; PB)AAEP " 1+1 )ist the emps who are wor:ing as Managers using co6relate' sub6$uery. A select ! from emp where empno in 1select mgr from emp " 1+# )ist the emps whose Mgr name is /%ones0 an' also with his Manager name. A select w.ename,m.ename,1select ename from emp where m.mgr ; empno Qhis MABALE@Q from emp w,emp m where w.mgr ; m.empno an' m.ename ; P%DBE*P" 1or B select e.ename,w.ename,m.ename from emp e,emp w,emp m where e.mgr ; w.empno an' w.ename ; /%DBE*0 an' w.mgr ; m.empno" 1+3 Define a Fariable representing the expression use' to calculate on emps total annual remuneration use the Fariable in a statement, which fin's all emps who can earn 3&&&& a year or more. A *et 'efine on .1 Define annual ; 1#!nFl#1comm.,salTcomm.,sal 1here 'efine Fariable is a session Fariable .# *elect ! from emp where Kannual > 3&&&&" 1++ Hin' out how may Managers are their in the company. .1 elect count1! from emp where (ob ; /MABALE@0" 1or

B select count1! from emp where empno in 1select mgr from emp " 1or < select count1'istinct m.empno from emp w,emp m where w.mgr ; m.empno " 1+- Hin' AFerage salary an' AFerage total remuneration for each %ob type. @emember *alesman earn commission.secommm A select aFg1sal ,aFg1salTnFl1comm,& from emp" 1+. <hec: whether all the emps numbers are in'ee' uni$ue. A select empno,count1! from emp group by empno" 1+2 )ist the emps who are 'rawing less than 1&&& *ort the output by *alary. A select ! from emp where sal 5 1&&& or'er by sal" 1+4 )ist the employee Bame, %ob, Annual *alary, 'eptno, Dept name an' gra'e who earn 3.&&& a year or who are not <)E@A*. .1 lecte.ename,e.(ob,11#!e.sal QABBOA)*A)A@?Q, e.'eptno,'.'name,s.gra'e from emp e,'ept ' ,salgra'e s where e.'eptno ; '.'eptno an' e.sal between s.losal an' s.hisal an' 1111#!e.sal >; 3.&&& or 1e.(ob J; P<)E@AP 1+3 Hin' out the %ob that was fille' in the first half of 1343 an' same (ob that was fille' 'uring the same perio' of 134+. .1 elect ! from emp where 1to9char1hire'ate,PMM P 5; &. an' to9char1hire'ate,P????P ; 134+ an' (ob in 1select (ob from emp where to9char1hire'ate,PMMP 5; &. an' to9char1hire'ate,P????P 5; 1343 " 1-& Hin' out the emps who (oine' in the company before their Managers. A select ! from emp w,emp m where w.mgr ; m.empno an' w.hire'ate5 m.hire'ate"1or B select ! from emp e where hire'ate 5 1select hire'ate from emp where empno ; e.mgr 1-1 )ist all the emps by name an' number along with their Manager0s name an' number. Also )ist A=BL who has no /Manager0. A select w.empno,w.ename,m.empno,m.ename from emp w,emp m where w.mgr; m.empno1T " 1-# Hin' all the emps who earn the minimum *alary for each (ob wise in ascen'ing or'er.

A select ! from emp where sal in 1select min1sal from emp group by (ob or'er by sal asc" 1-3 Hin' out all the emps who earn highest salary in each (ob type. *ort in 'escen'ing salary or'er. A select ! from emp where sal in 1select max1sal from emp group by (ob or'er by sal 'esc" 1-+ Hin' out the most recently hire' emps in each Dept or'er by 8ire'ate. A select ! from emp e where hire'ate in 1select max1hire'ate from emp where e.'eptno ; 'eptno or'er by hire'ate" 1-- )ist the employee name,*alary an' Deptno for each employee who earns a salary greater than the aFerage for their 'epartment or'er by Deptno. A select ! from emp e where sal > 1select aFg1sal from emp where e.'eptno ; 'eptno " B select e.ename,e.sal,e.'eptno from emp e,1select aFg1sal A,'eptno D from emp group by 'eptno D1 where D1.D ; e.'eptno an' e.sal > D1.A" 1-. )ist the Deptno where there are no emps. A select 'eptno ,count1! from emp group by 'eptno haFing count1! ; &" 1-2 )ist the Bo.of emp0s an' AFg salary within each 'epartment for each (ob. A select count1! ,aFg1sal ,'eptno,(ob from emp group by 'eptno,(ob" 1-4 Hin' the maximum aFerage salary 'rawn for each (ob except for /Presi'ent0. A select max1aFg1sal from emp where (ob J; PP@E*=DEBCP group by (ob" 1-3 Hin' the name an' %ob of the emps who earn Max salary an' <ommission. A select ! from emp where sal ; 1select max1sal from emp an' comm. is not null"

1.& )ist the Bame, %ob an' *alary of the emps who are not belonging to the 'epartment 1& but who haFe the same (ob an' *alary as the emps of 'ept 1&. .1 elect ename,(ob,sal from emp where 'eptno J; 1& an' (ob in 1select (ob from emp where 'eptno ; 1& an' sal in 1select sal from emp where 'eptno ; 1& " 1.1 )ist the Deptno, Bame, %ob, *alary an' *alT<omm of the *A)E*MAB who are earning maximum salary an' commission in 'escen'ing or'er. .1 lect 'eptno,name,(ob,sal,salTnFl1comm.,& from emp where (ob ; /*A)E*MAB0 an' sal in 1select max1salTnFl1comm.,& from emp where comm. is not null Dr'er by 1sal TnFl1comm.,& 'esc" 1.# )ist the Deptno, Bame, %ob, *alary an' *alT<omm of the emps who earn the secon' highest earnings 1sal T comm. . elect 'eptno,ename,sal,(ob,salTnFl1comm,& from emp e where # ; 1select count1'istinct salTnFl1comm,& from emp where 1e.salTnFl1comm.,& 51salTnFl1comm.,& " (*+, )ist the Deptno an' their aFerage salaries for 'ept with the aFerage salary less than the aFerages for all 'epartment !, select deptno-a g.sal, from emp group /y deptno '( ing a g.sal, 0.select a g.Sal, from emp,1 (*2, )ist out the Bames an' *alaries of the emps along with their manager names an' salaries for those emps who earn more salary than their Manager. A select w.ename,w.sal,m.ename,m.sal from emp w,emp m where w.mgr ; m.empno an' w.sal > m.sal" 1.- )ist out the Bame, %ob, *alary of the emps in the 'epartment with the highest aFerage salary. !, select 3 from emp where deptno in .select deptno from emp e ha ing a g.sal, 4.select ma5.a g.sal,, from emp group /y deptno, group /y deptno,1 1.. )ist the empno,sal,comm. Df emps.

.1

elect empno,sal,comm. from emp"

1.2 )ist the 'etails of the emps in the ascen'ing or'er of the sal. A select ! from emp or'er by sal asc" 1.4 )ist the 'ept in the ascen'ing or'er of the (ob an' the 'esc or'er of the emps print empno, ename. .1 elect ! from emp e or'er by e.(ob asc,e.empno 'esc " 1.3 Display the uni$ue 'ept of the emps. A select ! from 'ept where 'eptno in 1select uni$ue 'eptno from emp " 12& Display the uni$ue 'ept with (obs. .1 elect uni$ue 'eptno ,(ob from emp " 121 Display the 'etails of the bla:e. .1 elect ! from emp where ename ; /B)AAE0" 12# )ist all the cler:s. .1 elect ! from emp where (ob ; /<)E@A0" 123 list all the employees (oine' on 1st may 41. .1 elect ! from emp where hire'ate ; 0&16MA?6410" 12+ )ist the empno,ename,sal,'eptno of the 'ept 1& emps in the ascen'ing or'er of salary. A select e.empno,e.ename,e.sal,e.'eptno from emp where e.'eptno ; 1& & 'er by e.sal asc" 12- )ist the emps whose salaries are less than 3-&&. .1 elect ! from emp where sal 53-&&" 12. )ist the empno,ename,sal of all the emp (oine' before 1 apr 41. .1 elect e.empno ,e.ename .e.sal from emp where hire'ate 50&16AP@6410" 122 )ist the emp whose annual sal is 5#-&&& in the asc or'er of the salaries. .1 elect ! from emp where 11#!sal 5 #-&&& or'er by sal asc" 124 )ist the empno,ename,annsal,'ailysal of all the salesmen in the asc ann sal .1 elect e.empno,e.ename ,1#!sal QABB *A)Q , 11#!sal 73.- QDA=)? *A)Q from emp e where e.(ob ; P*A)E*MABP or'er by QABB *A)Q asc "

123 )ist the empno,ename,hire'ate,current 'ate K exp in the ascen'ing or'er of the exp. A select empno,ename,hire'ate,1select sys'ate from 'ual , 11months9between1sys'ate,hire'ate 71# ERP from emp or'er by ERP asc" 14& )ist the emps whose exp is more than 1& years. A select ! from emp where 11months9between1sys'ate,hire'ate 71# > 1&" 141 )ist the empno,ename,sal,CA3&G,DA +&G,8@A -&G,L@D**,)=<,PH,net,'e'uction,net allow an' net sal in the ascen'ing or'er of the net salary. 14# )ist the emps who are wor:ing as managers. .1 elect ! from emp where (ob ; /MABALE@0" 143 )ist the emps who are either cler:s or managers. .1 elect ! from emp where (ob in 1/<)E@A0,0MABALE@0 " 14+ )ist the emps who haFe (oine' on the following 'ates 1 may 41,12 noF 41,3& 'ec 41 A select ! from emp where to9char1hire'ate,0DD6MDB6??0 in 10&16MA?6410,0126BDX6410,03&6DE<6410 " 14- )ist the emps who haFe (oine' in the year 1341. A select ! from emp where to9char1hire'ate,0????0 ; /13410" 14. )ist the emps whose annual sal ranging from #3&&& to +&&&&. .1 elect ! from emp where 11#! sal between #3&&& an' +&&&&" 142 )ist the emps wor:ing un'er the mgrs 23.3,243&,2.-+,23&&. A select ! from emp where mgr in 1 23.3,243&,2.-+,23&& "

144 )ist the emps who (oine' in the secon' half of 4#. A select ! from emp where hire'ate between 0&16%O)64#0 an' 0316DE<64#0" 143 )ist all the +char emps. A select ! from emp where length 1ename ; +" 13& )ist the emp names starting with /M0 with - chars. .1 elect ! from emp where ename li:e /MG0 an' length 1ename ; -" 131 )ist the emps en' with /80 all together - chars. .1 elect ! from emp where ename li:e /G80 an' length 1ename ; -" 13# )ist names start with /M0. .1 elect ! from emp where ename li:e /MG0" 133 )ist the emps who (oine' in the year 41. .1 elect ! from emp where to9char1hire'ate,0??0 ; /410" 13+ )ist the emps whose sal is en'ing with &&. .1 select ! from where sal li:e /G&&0" 13- )ist the emp who (oine' in the month of %AB. A select ! from emp where to9char1hire'ate,0MDB0 ; /%AB0" 1D@ & select ! from emp where to9char 1hire'ate,0MM0 ; 1" 13. Eho (oine' in the month haFing char /a0. A select ! from emp where to9char 1hire'ate,0MDBC80 li:e0GAG0" 1D@ & select ! from emp where instr1to9char1hire'ate,0MDBC80 ,0A0 >&" 132 Eho (oine' in the month haFing secon' char /a0 A select ! from emp where to9char1hire'ate,0MDB0 li:e /9AG0" 1D@ & select ! from emp where instr1to9char1hire'ate,0MDB0 ,0A0 ; #" 134 )ist the emps whose salary is + 'igit number. A select ! from emp where length 1sal ; +"1D@ & select ! from emp where sal between 333 an' 3333" 133 )ist the emp who (oine' in 4&0s. .1 elect ! from emp where to9char1hire'ate,0??0 between /4&0 an' 0430" 1D@

& select ! from emp where to9char1hire'ate,0??0 >; /4&0 an' to9char1hire'ate,0??0 5 /3&0" #&& )ist the emp who are cler:s who haFe exp more than 4ys. .1 elect ! from emp where (ob ; /<)E@A0 an' 1months9between1sys'ate,hire'ate 71# > 4" #&1 )ist the mgrs of 'ept 1& or #&. .1 elect ! from emp where (ob ; /MABALE@0 an' 1'eptno ; 1& or 'eptno ;#& " #&# )ist the emps (oine' in (an with salary ranging from 1-&& to +&&&. A select ! from emp where to9char1hire'ate,0MDB0 ; /%AB0 an' sal & tween 1-&& an' +&&&" #&3 )ist the uni$ue (obs of 'ept #& an' 3& in 'esc or'er. .1 elect 'istinct (ob from emp where 'eptno in 1#&,3& or'er by (ob 'esc" #&+ )ist the emps along with exp of those wor:ing un'er the mgr whose number is starting with 2 but shoul' not haFe a 3 (oine' before 1343. A select ! from emp where 1mgr li:e P2GP an' mgr not li:e PG3GP an' to9char1hire'ate,P??P 5 P43P" #&- )ist the emps who are wor:ing as either mgr or analyst with the salary ranging from #&&& to -&&& an' with out comm. .1 elect ! from emp where 1(ob in 1/MABALE@0 ,0ABA)?*C0 an' sal between #&&& an' -&&& an' comm is null" #&. )ist the empno,ename,sal,(ob of the emps with 7ann sal 53+&&& but receiFing some comm. Ehich shoul' not be>sal an' 'esg shoul' be sales man wor:ing for 'ept 3&. .1 elect empno,ename,sal,(ob from emp where 1#!1salTnFl1comm,& 5 3+&&& an' comm is not null an' comm5sal an' (ob ; P*A)E*MABP an' 'eptno ; 3&" #&2 )ist the emps who are wor:ing for 'ept 1& or #& with 'esgs as cler: or analyst with a sal is either 3 or + 'igits with an exp>4ys but 'oes not belong to mons of mar,apr,sep an' wor:ing for mgrs Kno is not en'ing with 44 an' -.. .1 elect ! from emp where 'eptno in 11&,#& an' (ob in 1P<)E@AP,PABA)?*CP an'

1length1sal in 13,+ an' 11months9between1sys'ate,hire'ate 71# > 4 an' to9char1hire'ate,PMDBP not in 1PMA@P,P*EPP,PAP@P an' 1mgr not li:e PG44P an' mgr not li:e PG-.P " #&4 )ist the empno,ename,sal,(ob,'eptnoKexp of all the emps belongs to 'ept 1& or #& with an exp . to 1& y wor:ing un'er the same mgr with out comm. Eith a (ob not en'ing irrespectiFe of the position with comm.>#&& with exp>;2y an' sal5#-&& but not belongs to the month sep or noF wor:ing un'er the mgr whose no is not haFing 'igits either 3 or & in the asc 'eptK 'esc 'ept A #&3 )ist the 'etails of the emps wor:ing at <hicago. .1 elect ! from emp where 'eptno in 1select 'eptno from 'ept where 'ept.loc ; /<8=<ALD0 " #1& )ist the empno,ename,'eptno,loc of all the emps. A select e.empno,e.ename,e.'eptno,'.loc from emp e ,'ept ' where e.'eptno ; '.'eptno " #11 )ist the empno,ename,loc,'name of all the 'epts.,1& an' #&. A select e.empno,e.ename,e.'eptno,'.loc,'.'name from emp e ,'ept ' where e.'eptno ; '.'eptno an' e.'eptno in 11&,#& " #1# )ist the empno, ename, sal, loc of the emps wor:ing at <hicago 'allas with an exp>.ys. A select e.empno,e.ename,e.'eptno,e.sal,'.loc from emp e ,'ept ' where e.'eptno ; '.'eptno an' '.loc in 1P<8=<ALDP,PDA))A*P an' 1months9between1sys'ate,hire'ate 71# > . " #13 )ist the emps along with loc of those who belongs to 'allas ,newyor: with sal ranging from #&&& to -&&& (oine' in 41. A select e.empno,e.ename,e.'eptno,e.sal,'.loc from emp e ,'ept ' where e.'eptno ; '.'eptno an' '.loc in 1PBEE ?D@AP,PDA))A*P an' to9char1e.hire'ate,P??P ; P41P an' e.sal between #&&& an' -&&&" #1+ )ist the empno,ename,sal,gra'e of all emps. A select e.empno,e.ename,e.sal,s.gra'e from emp e ,salgra'e s where e.sal between s.losal an' s.hisal " #1- )ist the gra'e # an' 3 emp of <hicago. A select ! from emp where empno in 1select empno from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e in 1#,3 "

#1. )ist the emps with loc an' gra'e of accounting 'ept or the locs 'allas or <hicago with the gra'es 3 to - Kexp >.y A select e.'eptno,e.empno,e.ename,e.sal,'.'name,'.loc,s.gra'e from emp e,salgra'e s,'ept ' & eree.'eptno ; '.'eptno an' e.sal between s.losal an' s.hisal 1 an' s.gra'e in 13,an' 11months9between1sys'ate,hire'ate 71# > . an' 1 '.'name ; PA<<DOBC=BLP or D.loc in 1PDA))A*P,P<8=<ALDP #12 )ist the gra'es 3 emps of research an' operations 'epts.. (oine' after 1342 an' whose names shoul' not be either miller or allen. A select e.ename from emp e ,'ept ',salgra'e s where e.'eptno ; '.'eptno an' '.'name in 1PDPE@AC=DB*P,P@E*EA@<8P an' e.sal between s.losal an' s.hisal an' e.ename not in 1PM=))E@P,PA))EBP an' to9char1hire'ate,P????P >1342" #14 )ist the emps whose (ob is same as smith. .1 elect ! from emp where (ob ; 1select (ob from emp where ename ; P*M=C8P " #13 )ist the emps who are senior to mi ##& )ist the emps whose (ob is same as either allen or sal>allen. A select ! from emp where (ob ; 1select (ob from emp where ename ; PA))EBP or sal > 1select sal from emp where ename ; PA))EBP " ##1 )ist the emps who are senior to their own manager. A select ! from emp w,emp m where w.mgr ; m.empno an' w.hire'ate 5 m.hire'ate" ### )ist the emps whose sal greater than bla:es sal. A select ! from emp where sal>1select sal from emp where ename ; /B)AAE0 " ##3 )ist the 'ept 1& emps whose sal>allen sal. A select ! from emp where 'eptno ; 1& an' sal > 1select sal from emp where ename ; PA))EBP " ##+ )ist the mgrs who are senior to :ing an' who are (unior to smith. .1 lect ! from emp where empno in

1select mgr from emp where hire'ate51select hire'ate from emp where ename ; PA=BLP an' hire'ate > 1select hire'ate from emp where ename ; P*M=C8P an' mgr is not null" ##- )ist the empno,ename,loc,sal,'name,loc of the all the emps belonging to :ing 'ept. A select e.empno,e.ename,'.loc,e.sal,'.'name from emp e,'ept ' where e.'eptno;'.'eptno an' e.'eptno in 1select 'eptno from emp where ename ; PA=BLPan' emp.empno 5> e.empno " ##. )ist the emps whose salgra'e are greater than the gra'e of miller. A select ! from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e > 1select s.gra'e from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' e.ename ; PM=))E@P " ##2 )ist the emps who are belonging 'allas or <hicago with the gra'e same as a'amsor exp more than smith. A select ! from emp e ,'ept ',salgra'e s where e.'eptno; '.'eptno an' '.loc in 1PDA))A*P,P<8=<ALDP an' e.sal between s.losal an' s.hisal an' 1s.gra'e in 1select s.gra'e from emp e,salgra'e s where e.sal between s.losal an' s.hisal an' e.ename ; PADAM*P or months9between 1sys'ate,hire'ate > 1select months9between1sys'ate,hire'ate from emp where ename ; P*M=C8P " ##4 )ist the emps whose sal is same as for' or bla:e. .1 elect ! from emp where sal in 1select sal from emp e where e.ename in 1PHD@DP,PB)AAEP an' emp.empno 5> e.empno " ##3 )ist the emps whose sal is same as any one of the following. A select ! from emp where sal in 1select sal from emp e where emp.empno 5> e.empno " #3& *al of any cler: of emp1 table. .1 elect ! from emp where (ob ; /<)E@A0" #31 Any emp of emp# (oine' before 4#. A select ! from emp where to9char1hire'ate,P????P 5 134#" #3# Che total remuneration 1salTcomm. of all sales person of *ales 'ept belonging to emp3 table.

A select ! from emp e where 1salTnFl1comm,& in 1select salTnFl1comm,& from emp e,'ept ' where e.'eptno;'.'eptno an' '.'name ; P*A)E*Pan' e.(ob ; P*A)E*MABP " #33 Any Lra'e + emps *al of emp + table. A select ! from emp+ e,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e ; +" #3+ Any emp *al of emp- table. A select ! from emp-" #3- )ist the highest pai' emp. A select ! from emp where sal in 1select max1sal from emp " #3. )ist the 'etails of most recently hire' emp of 'ept 3&. A select ! from emp where hire'ate in 1select max1hire'ate from emp where 'eptno ; 3& " #32 )ist the highest pai' emp of <hicago (oine' before the most recently hire' emp of gra'e #. A select ! from emp where sal ; 1 select max1sal from emp e,'ept ' where e.'eptno ; '.'eptno an' '.loc ; /<8=<ALD0 an' hire'ate 51select max1hire'ate from emp e ,salgra'e s where e.sal between s.losal an' s.hisal an' s.gra'e ; # #34 )ist the highest pai' emp wor:ing un'er :ing. .1 lect ! from emp where sal in 1select max1sal from emp where mgr in 1select empno from emp where ename ; PA=BLP "

You might also like