1 to 200 Queries

download 1 to 200 Queries

of 18

Transcript of 1 to 200 Queries

  • 7/31/2019 1 to 200 Queries

    1/18

    Oracle Queries

    001. Display all the information of the emp table.

    SQL> select * from emp

    002. Display unique jobs from EMP table.

    SQL> select job from emp GROUP BY job

    003. List the details of the emps in asc order of their salaries.

    SQL> select * from emp order by SAL ASC;

    004. List the details of the emps in asc order of the Deptnos and desc ofJobs.

    SQL> select * from emp order by DEPTNO ASC, JOB DESC;

    005. Display all the unique job groups in the descending order

    SQL>

    006. Display all the details of all Mgrs

    SQL> select * from emp where job='MANAGER'

    007. List the emps who joined before 1981.

    SQL> select * from emp where hiredate < '01-JAN-81';

    008. List the Empno, Ename, Sal, Daily Sal of all Employees in the ASCorder of AnnSal.

    SQL> select SAL,(SAL + nvl(comm,0)) from emp order by (SAL +nvl(comm,0)) ASC

    009. Display the empno , ename, job, hiredate, exp of all Mgrs

    SQL> select empno, ename, job, hiredate,months_between(sysdate,hiredate)/12 as "Experience in years" fromemp where job = 'MANAGER'

    010. List the empno, ename, sal, exp of all emps working for Mgr 7839.

    SQL> select empno, ename, sal, months_between(sysdate,hiredate)/12 as"Exepereince in years" from emp where MGR = 7839

    011. Display the details of the emps whose Comm. Is more than their sal.SQL> select * from emp where nvl(comm,0) > sal

    012. List the emps in the asc order of Designations

    SQL> select * from emp order by job ASC

    013. List the emps along with their exp and daily sal is more than Rs.100

    SQL> select * from emp where SAL/30 > 100

    014. List the emps who are either CLERK or ANALYST in the desc order

    SQL> select * from emp where job in ('CLERK','ANALYST')

  • 7/31/2019 1 to 200 Queries

    2/18

    order by job DESC

    015. List the emps who joined on 1May81,31Dec81, 17Dec81, 19Jan80 inasc order of seniority.

    SQL> select ename from emp where hiredate in ('1-MAY-81','31-DEC-81','17-DEC-81','19-JAN-80') order by hiredate ASC

    016. List the emps who are working for the deptno 10 or 20SQL> select * from emp where deptno in ('10','20')

    017. List the emps who are joined in the year 1981

    SQL> select * from emp where hiredate like '%81'

    018. List the emps who are joined in the month of Aug 1980

    SQL> select * from emp where hiredate like '%AUG-80'

    019. List the emps whose annul sal ranging from 22000 and 45000

    SQL> select * from emp where SAL*12 between 22000 and 45000

    020. List the emps those are having five characters in their names.

    SQL> select * from emp where ename like '_____'

    021. List the enames those are starting with s and with fire characters

    SQL> select * from empwhere ename like 'S____'

    022. List the emps those are having four chars and third char must be r

    SQL> select * from emp where ename like '__R_'

    023. List the 5 character names starting with s and ending with hSQL> select * from emp where ename like 'S___H'

    024. List the emps who joined in January

    SQL> select * from emp where hiredate like '%JAN%'

    025. List the emps who joined in the month of which second character is a

    SQL> select * from emp where to_char(hiredate,'MON') like '_A%'

    026. List the emps whose sal is 4 digit number ending with zero

    SQL> select * from emp where SAL like '___0'

    027. List the emps whose names having a character set ll together

    SQL> select * from emp where ename like '%LL%'

    028. List the emps those who joined in 80s

    SQL> select * from emp where to_char(hiredate, 'YY') like '80'

    029. List the emps who does not belong to deptno 20

    SQL> select * from emp where deptno not like '20'

  • 7/31/2019 1 to 200 Queries

    3/18

    030. List all the emps except president & Mgr in asc order of salaries

    SQL> select * from emp where job!=ALL('PRESIDENT','MANAGER') orderby job ASC;

    031. List the emps who joined in before or after 1981

    SQL> select * from emp where to_char(hiredate, 'YY') != 80

    032. List the emps whose empno not starting with digit 78

    SQL> select * from emp where empno not like '78__'

    033. List the emps who are working under Mgr

    SQL>

    034. List the emps who joined in any year but not belongs to the month ofMarch

    SQL> select * from emp where to_char(hiredate, 'MON') not like 'MAR'

    035. List all the clerks of deptno 20.

    SQL> select * from emp where job = 'CLERK' and deptno = '20'

    036. List the emps of deptno 30 or10 joined in the year 1981

    SQL> select * from emp where deptno in ('30','10') and to_char(hiredate,'YY') like '81'

    037. Display the details of Smith

    SQL> select * from emp where ename = 'SMITH'

    038. Display the location of Smith

    SQL> select loc from emp where ename = 'SMITH'

    039. List the total information of emp table along with dname and loc of allthe emps working under Accounting & Research in the asc deptno

    SQL> select * from emp where job in ('ACCOUNTING', 'RESEARCH') orderby job ASC

    040. List the empno, ename, sal, dname of all the Mgrs and Analystworking in NEWYORK, DALLAS with an exp more than 7 years withoutreceiving the Comma Asc order of Loc.

    SQL> select * from emp where job in('MANAGER','ANALYST') andmonths_between(sysdate,hiredate)/12 > 7 order by job ASC

    041. List the empno, ename, sal, dname, loc, deptno, job of all empsworking at CHICAGO or working for ACCOUNTING dept wit ann sal >28000, but the sal should not be = 3000 or 2800 who doesnt belongsto the Mgr and whose no is having a digit 7 or 8 in 3 rd position in theasc order of deptno and desc order of job.

    SQL>

    042. Display the total information of the emps along with grades in the ascorder

    SQL> select * from emp, salgrade where sal between losal and hisal order by

  • 7/31/2019 1 to 200 Queries

    4/18

    'salgrage' ASC

    043. List all the grade2 and grade 3 emps

    SQL> select * from emp, salgrade where grade in (2,3) and sal between losaland hisal

    044. Display all grade 4,5 Analyst and Mgr

    SQL> select * from emp, salgrade where grade in(4,5) and sal between losal

    and hisal and job in ('MANAGER','ANALYST')

    045. List the empno, ename, sal, dname, grade, exp, ann sal of empsworking for dept 20 or 10.

    SQL> select * from emp, dept, salgrade where emp.deptno in (10,20) andemp.deptno=dept.deptno and sal between losal and hisal

    046. List all the information of emps with loc and the grade of all the empsbelong to the grade ranges from 2 to 4 working at the dept those arenot starting with char set OP and not ending with S with the designhaving a char a any where joined in the year 81 but not in the month

    of Mar or Sep and sal not end with 00 in the asc order of grades.SQL>

    047. List the details of the depts along with empno, ename or without theemps

    SQL> Select empno, ename, dept.* from emp,dept whereemp.deptno=dept.deptno ;

    048. List the details of the emps whose salaries more than the employeeBLAKE

    SQL> select * from emp where SAL > (select sal from emp where ename =

    'BLAKE')

    049. List the details of the emps whose job is same as ALLEN.

    SQL> select * from emp where job = (select job from emp where ename ='ALLEN')

    050. List the emps who are senior to King

    SQL> select * from emp where hiredate < (select hiredate from emp whereename= 'KING')

    051. List the emps who are senior to their own MGRs

    SQL> select * from emp A where A.hiredate < (select hiredate from emp Bwhere B.empno = A.MGR)

    052. List the emps of deptno 20 whose jobs are same as deptno 10

    SQL> select * from emp where deptno = '20' and job in (select job from empwhere deptno = '10')

    053. List the emps whose Sal is same as FORD or SMITH in desc order ofSal.

    SQL> select * from emp where sal in (select sal from emp where ename in

  • 7/31/2019 1 to 200 Queries

    5/18

    ('FORD','SMITH')) and ename not in ('FORD','SMITH') order by salDESC

    054. List the emps whos Jobs are same as MILLER or Sal is more thanALLEN.

    SQL> select * from emp where job = (select job from emp where ename ='MILLER') or sal > (select sal from emp where ename = 'ALLEN')

    055. List the emps whose Sal is > the total remuneration of theSALESMAN.

    SQL> select * from emp where sal >(select SUM(sal) from emp where job ='SALESMAN')

    056. List the emps who are Senior to BLAKE working at CHICAGO &BOSTON.

    SQL> select * from emp,dept where hiredate < (select hiredate from empwhere ename = 'BLAKE') and loc in ('CHICAGO','BOSTON') andemp.deptno = dept.deptno

    057. List the emps of Grade 3,4 belongs to the dept ACCOUNTING andRESEARCH whose sal is more than ALLEN and exp more thanSMITH in the asc order of Exp.

    SQL> .select * from emp,salgrade,dept where grade in ('3','4') and dname in('ACCOUNTING','RESEARCH') and sal > (select sal from emp whereename = 'ALLEN') and hiredate < (select hiredate from emp whereename = 'SMITH') and emp.deptno = dept.deptno and sal betweenlosal and hisal order by hiredate ASC

    058. List the emps whose jobs same as ALLEN Or SMITH.

    SQL> select * from emp where job in (select job from emp where ename in

    ('ALLEN','SMITH')) and ename not in ('ALLEN','SMITH')

    059. Write a Query to display the details of emps whose Sal is same as ofa) Employee Sal of Emp1 table.b) Sal of any Mgr of Emp2 table.c) The Sal of any sales person with exp of 5 yrs belongs to the

    sales dept of emp3 table.d) Any Grade 2 employees of Emp4 table.e) Any Grade 2&3 employee working for SALES dept or

    OPERATIONS dept joined in 89.

    SQL>

    060. List the jobs of Deptno 10 those are not found in dept 20.

    SQL> Select * from emp where deptno = 10 and job not in (select job fromemp where deptno=20)

    061. List the emps of Emp1 who are not found in deptno 20

    SQL> select * from emp where ename not in (select ename from emp wheredeptno = 20)

    062. Find the highest Sal of the Emp table.

    SQL> select MAX(sal) from emp

  • 7/31/2019 1 to 200 Queries

    6/18

    063. Find the details of highest paid employee.

    SQL> select * from emp where sal = (select MAX(sal) from emp)

    064. Find the highest paid employee of sales dept.

    SQL>

    065. List the most recently hired emp of grade 3 belongs to the Loc

    CHICAGOSQL>

    066. List the emps who are senior to most recently hired emp who isworking under Mgr KING

    SQL>

    067. List the details of emp belongs to New York with the Grade 3 to 5except PRESIDENT whose sal > the highest paid emp of CHICAGOin Group where there is MANAGER & ANALYST not working for MgrKING

    SQL>

    068. Display the details of most senior employee belongs to 1981.

    SQL>

    069. List the emps who joined in 81 with job same as the most seniorperson of year 81.

    SQL>

    070. List the most senior emp working under KING and Grade is more than3.

    SQL>

    071. Find the total sal given to the MGR

    SQL>

    072. Find the total annual sal to distribute job wise in the year 81

    SQL>

    073. Display the total sal of emps belong to Grade 3.

    SQL>

    074. Display the avg salaries of all CLERKS

    SQL>

    075. List the emps in dept 20 whose sal is > the avg sal of deptno 10 emps.

    SQL>

    076. Display the number of emps for each job group deptno wise

    SQL>

  • 7/31/2019 1 to 200 Queries

    7/18

    077. List the Mgr no & no. of emps working for those Mgrs in the asc Mgrno.

    SQL>

    078. List the dept details where at least two emps are working.

    SQL>

    079. Display the grade, number of emps, max sal of each grade.

    SQL>

    080. Display dname, grade, no of emps where atleast two emps areCLERKS

    SQL>

    081. List the details of the dept where the max no of emps are working

    SQL>

    082. Display the emps whose Mgr name is Jones

    SQL>

    083. List the emps whose salary is more than 3000 after giving 20%increment

    SQL>

    084. List the emps with their dept names.

    SQL>

    085. List the emps who are not working in sales dept

    SQL>

    086. List the emps name, dept, sal & comm. For those whose salary is

    between 2000 and 5000 while loc is CHICAGOSQL>

    087. List the emps whose salary is > his Managers salary.

    SQL>

    088. List the grade, employee name for the deptno 10 or deptno 30 butsalgrade is not 4 while they joined the company before 31-DEC-82

    SQL>

    089. List the name, job, dname, loc for those who are working as a MGRsSQL>

    090. List the emps whose mgr name is JONES and also list their managername

    SQL>

    091. List the name and salary of FORD if his salary is equal to hisal of hisGrade

    SQL>

  • 7/31/2019 1 to 200 Queries

    8/18

    092. List the name, job, dname, Manager, salary, Grade dept wise.

    SQL>

    093. List the emps name, job, salary, grade and dname except CLERKsand sort on the basis of highest salary.

    SQL>

    094. List the emps name, job and Manager who are without Manager.

    SQL>

    095. List the names of emps who are getting the highest salary dept wise.

    SQL>

    096. List the emps whose salary is equal to average of maximum andminimum.

    SQL>

    097. List the no of emps in each dept where the number is more than 3.

    SQL>

    098. List the names of depts. Where at least 3 emps are working in eachdept.

    SQL>

    099. List the managers whose salary is more than his emps avg sal.

    SQL>

    100. List the name, sal, comm. For those emps whose net pay is > or = anyother employee salary of the company.

    SQL>

    101. List the emps whose sal < his Manager but more than other Manager

    SQL>

    102. List the employee names and his annual salary dept wise.

    SQL>

    103. Find out least 5 earners of the company.

    SQL>

    104. Find out the no of emps whose salary is > their Manager salary.SQL>

    105. List the Mgrs who are not working under PRESIDENT but are workingunder other Manager.

    SQL>

    106. List the records from emp whose deptno is not in dept

    SQL>

    107. List the name, sal, comm. And net pay is more than any other

  • 7/31/2019 1 to 200 Queries

    9/18

    employee.

    SQL>

    108. List the enames who are retiring after 31-DEC-89 the max job periodis 20Y.

    SQL>

    109. List those emps whose sal is odd value.

    SQL>

    110. List the emps whose sal contain 3 digits

    SQL>

    111. List the emps who joined in the month of DEC

    SQL>

    112. List the emps whose names contains A

    SQL>

    113. List the emps whose deptno is available in his salary.SQL>

    114. List the emps whose first 2 chars from hiredate = last 2 chars ofsalary.

    SQL>

    115. List the emps whose 10% of sal is equal to year of Joining

    SQL>

    116. List first 50% of chars of ename in lower case and remaining are

    upper case.SQL>

    117. List the dname whose no of emps is = to no of chars in thedname.

    SQL> THIS QUERY WILL WORK AFTER MODIFING EMP TABLE. ATPRESET THERE ARE NO SUCH DNAME WHERE NO. OF EMPS =NO OF CHARS IN THE DNAME. TO GET THE OUTPUT, I HAD TOCHANGE ONE SALES DEPT(DEPTNO 30) EMP TO SOME OTHERDEPT SO THAT THE NO OF CHARS IN SALES DEPT(5) IS = NOOF EMPS OF THAT DEPT. [AT PRESENT THERE ARE 6 EMPS]

    IF U DONT CHANGE THE ABOVE, U GET THE WRONG O/P FORTHE SAME.

    118. List the emps those who joined in company before 15th of themonth.

    SQL>

  • 7/31/2019 1 to 200 Queries

    10/18

    119. List the dname, no of chars of which is no of emps in any other dept

    SQL>

    120. List the emps who are working as managers

    SQL>

    121. List the name of dept where highest no of emps are working

    SQL>

    122. Count the no of emps who are working as Managers (using setoption)

    SQL>

    123. List the emps who joined in the company on the same dateSQL>

    124. List the details of the emps whose grade is equal to one tenth of salesdept.

    SQL>

    125. List the name of the dept where more than avg. no of emps areworking

    SQL>

    126. List the managers name who is having max no of emps working underhim

    SQL>

    127. List the ename and sal is increased by 15% and expressed as no ofdollars.

    SQL>

    128. Produce the output of EMP table EMP_AND_JOB for ename and job

    SQL>

    129. Produce the following output from EMP

    EMPLOYEE----------------SMITH(clerk)

    ALLEN(salesman)

    SQL>

    130. List the emps with hiredate in format June 4,1988.

    SQL>

  • 7/31/2019 1 to 200 Queries

    11/18

    131. Print a list of emps listing just salary if salary is more than 1500, Ontarget if salary is 1500 and Below 1500 if salary is less than 1500.

    SQL>

    132. Write a query to return the day of the week for any date entered in

    format DD-MM-YYSQL>

    133. Wrote a query to calculate the length of service of any employee withthe company, use DEFINE to avoid repetitive typing of functions

    SQL>

    134. Give a string of format NN/NN, verify that the first and last twocharacters are numbers and that the middle character is /. Print theexpression YES if valid, NO if not valid. Use the following values totest your solution.

    12/34, 01/la, 99/98SQL>

    135. Emps hired on or before 15th of any month are paid on the last Fridayof that month. Those hired after 15th are paid on the first Friday of thefollowing month. Print a list of emps, their hiredate and the first paydate. Sort on hiredate.

    SQL>

    136. Count the no of characters without considering spaces for each name.

    SQL>

    137. Find out the emps who are getting decimal value in their sal withoutusing like operator.

    SQL>

    138. List those emps whose salary contains first two digit of theirdeptno. ???

    SQL>

    139. List those managers who are getting less than his emps salary.SQL>

    140. Print the details of all the emps who are sub-ordinates to BLAKE.

    SQL>

    141. List the emps who are working as managers using co-related sub-query

    SQL>

  • 7/31/2019 1 to 200 Queries

    12/18

    142. List the emps whose Mgr name is JONES and also with his ManagerName.

    SQL>

    143. Define a variable representing the expression used to calculate onemps total annual remuneration. Use the variable in a statement whichfinds all emps who can earn 30000 a year or more.

    SQL>

    144. Find out how many managers are there in the company.

    SQL>

    145. Find avg sal and avg total remuneration for each job type. Remembersalesman earn commission.

    SQL>

    146. Check whether all the emps numbers are indeed unique.

    SQL>

    147. List the emps who are drawing less than 1000. sort the output bysalary.

    SQL>

    148. List the employee name, job, annual sal, deptno, dept name, andgrade who earn 36000 a year or who are not CLERKS.

    SQL>

    149. Find out the job that was filled in the first half of 1983 and same jobthat was filled during the same period of 1984.

    SQL>

    150. Find out the emps who joined in the company before their managers.

    SQL>

    151. List all the emps by name and number along with their managersname and number also list KING who has no Manager

    SQL>

    152. Find all the emps who earn minimum sal for each job wise in asc orderof sal

    SQL>

    153. Find out all the emps who earn highest sal in each job type. Sort in desorder of sal

    SQL>

  • 7/31/2019 1 to 200 Queries

    13/18

    154. Find out the most recently hired emps in each dept order by hiredate

    SQL>

    155. List the emp name, sal and deptno for each emp who earns a salgreater than the avg for their dept order by deptno

    SQL>

    156. List the deptno where there are no emps

    SQL>

    157. List the no of emps and avg salary within each dept for each job.

    SQL>

    158 Find the max avg salary drawn for each job except for PRESIDENT

    SQL>

    159. Find the name and job of the emps who earn Max salary and

    Commission.SQL>

    160. List the name, job and salary of the emps who are not belonging to thedept 10 but who have the same job and salary as the emps of dept 10.

    SQL>

    161. List the deptno, name, job, salary and sal+comm. Of the emps whoearn the second highest earnings (sal+comm)

    SQL>

    162. List the deptno, name, job, salary and sal+comm. Of the salesman

    SQL>

    163. List the deptno and their avg salaries for dept with the avg salary lessthan the avg for all departments.

    SQL>

    164. List out the names and salaries of the emps along with their managernames and salaries for those emps who earn more salary than their

    manager.SQL>

    165. List out the name, job, sal of the emps in the department with thehighest avg sal.

    SQL>

    166. List the empno, sal and comm. of emps

    SQL>

  • 7/31/2019 1 to 200 Queries

    14/18

    167. List the details of the emps in the asc order of salary.

    SQL>

    168. List the dept in asc order of job and the desc order of emps printempno, ename

    SQL>

    169. Display the unique dept of emps.

    SQL>

    170. Display the unique dept with jobs.

    SQL>

    171. Display the details of BLAKE.

    SQL>

    172. List all CLERKs

    SQL>

    173. List all emps joined on 1 May 81.SQL>

    174. List empno, ename,sal, deptno of dept 10 emps in the asc order of sal.

    SQL>

    175. List the emps whose salaries are less than 3500.

    SQL>

    176. List the emps Empno, Ename,sal for all emp joined before 1 apr 81

    SQL>

    177. List the emps whose ann sal is < 25000 in the asc order of salaries

    SQL>

    178. List the empno, ename, ann sal, daily sal of all salesman in the ascann sal.

    SQL>

    179. List the empno, ename, hiredate, current date & exp in the asc order ofexp.

    SQL>

    180. List the emps whose exp is more than 10 years.

    SQL>

    181. List the empno, ename,sal TA 30%, DA 40%, HRA 50%, gross, LIC,PF, net deductions, net allowances and net sal in the asc order of netsal.

    SQL>

  • 7/31/2019 1 to 200 Queries

    15/18

    182. List the emps who are working as Mgrs.

    SQL>

    183. List the emps who are either CLERKs or MANAGERs.

    SQL>

    184. List the emps who joined in the following dates : 1 may 81, 17 nov 81,

    30 dec 81.SQL>

    185. List the emps who joined in year 81.

    SQL>

    186. List the emps whose ann sal ranging from 23000 to 40000.

    SQL>

    187. List the emps working under the Mgrs 7369, 7890, 7654, 7900.

    SQL>

    188. List the emps who joined in the second half of 82.

    SQL>

    189. List all the 4 chars emps.

    SQL>

    190. List the emps names starting with M with 5 chars

    SQL>

    191. List the emps names end with H all together 5 chars.

    SQL>

    192. List the names start with M

    SQL>

    193. List the emps who joined in the year 81

    SQL>

    194. List the emps whose sal is ending with 00.SQL>

    195. List the emps who joined in the month of jan

    SQL>

    196. List the emps who joined in the month having a char a

    SQL>

    197. List the emps who joined in the month having a second char is A

    SQL>

  • 7/31/2019 1 to 200 Queries

    16/18

    198. List the emps whose salary is 4 digit no.

    SQL>

    199. List the emps who joined in 80s.

    SQL>

    200. List the emps who are either clerks with an exp more than 8y

    SQL>

    201. List the Mgrs of dept 10 or 20.

    SQL>

    202. List the emps joined in Jan with salary ranging from 1500 to 4000.

    SQL>

    203. List the unique jobs of depts. 20 or 30 in des order

    SQL>

    204. List the emps along with the exp of those working under the mgrwhose no is starting with 7 but should not have a digit 9 joined before1983.

    SQL>

    205. List the emps who are working as either mgr or analyst with sal rangingfrom 2000 and 5000 and without comm..

    SQL>

    206. List the empno, ename, sal, job of emps with the ann sal < 34000 but

    receiving some comm., Which should not be > sal and designationshould be salesman working for dept 30.

    SQL>

    207. List the emps who are working for dept 10 or 20 with desigs as CLERKor analyst with a sal is either 3 or 4 digits with an exp > 8y, but notbelongs to months of MAR, APR & SEP and working for mgrs & no isnot ending with 88 or 56.

    SQL>

    208. List the empno, ename, sal, job, deptno & exp of all emps belongs todept 10 or 20 with an exp 6 to 10 yrs working under some mgr withoutcomm., with a job not ending with MAN but sal > 850 or the empsworking for dept 30 with a job having a char A irrespective of theposition with comm. > 200 with exp >= 7y and sal < 2500 but notbelongs to the month SEP or NOV working under the Mgr whose no isnot having digits either 9 or 0 in the asc dept & desc dept. [???]

    SQL>

    209. List the details of emps working at CHICAGO.

    SQL>

  • 7/31/2019 1 to 200 Queries

    17/18

    210. List the empno, ename,deptno, loc of all emps

    SQL>

    211. List the empno, ename, loc, dname of all depts. 10 or 20.

    SQL>

    212. List the empno, sal, loc of all emps working at CHICAGO, DALLAS

    with an exp> 6yrs.SQL>

    213. List the emps along with loc of those who belongs to Dallas, new yorkwith sal ranging from 2000 to 5000 joined in 81.

    SQL>

    214. List the empno, ename, sal, grade of all emps.

    SQL>

    215. List the grade 2&3 emp of Chicago

    SQL>

    216. List the emps with loc & grade of accounting dept or the locs Dallas orChicago with the grades 3 to 5 & exp > 6y.

    SQL>

    217. List the grade 3 emps of research & operations depts. Joined after1987 and whose names should not be either miller or allen.

    SQL>

    218. List the emps whose job is same as smith.SQL>

    219. List the emps who are senior to miller.

    SQL>

    220. List the emps whose job is same as either allen or sal > allen

    SQL>

    221. List the emps who are senior to their own mgr.

    SQL>

    222. List the emps whose sal > blakes

    SQL>

    223. List the emps who belongs to dept 10 and sal > allens sal

    SQL>

    224. List the Mgrs who are senior to king & who are junior to smith.

    SQL>

  • 7/31/2019 1 to 200 Queries

    18/18

    225. List the empno, ename, loc, sal, dname,loc of all the emps belong tokings dept

    SQL>

    226. List the emps whose grade are > the grade of miller.

    SQL>

    227. List the emps who are belongs to dallas or Chicago with the grade

    same as adams or exp more than smith.SQL>

    228. List the emps whose sal is same as ford or blake.

    SQL>

    229. List the emps whose sal is same as any one of the following:a) Sal of any clerk of emp1 table.b) Any emp of emp2 joined before 83.c) The total remuneration (Sal+comm.) of all sales person of sales

    dept belongs to emp2 table.

    d) Any grade 4 emps sal of emp4 tablee) Any emp sal of emp5 table

    SQL>

    230. List the highest paid emp

    SQL>

    231. List the details of most recently hired emp of dept 30.

    SQL>

    232. List the highest paid emp of Chicago joined before the most recently

    hired emp of grade 2.SQL>

    233. List the highest paid emp working under king.

    SQL>

    END OF BOOK QUERIES

    234. List the second highest paid emp

    SQL>

    235. Find the oldest date between current date and 01_JAN-83.SQL>