Queries 2
Queries 2
5). Display the empno, ename, job, Hiredate, and exp of all managers.
6). List the empno, ename, sal, exp of all employees working for MGR
7369.
7). Display all the details of all employees whose Commision is more than
their sal
8). List the emps along with their exp and whose daily sal is more than Rs.100
9). List the emps who are working for the Deptno 10 or 20.
16). List the emps whose salary is more than 3000 after giving 20%
increment.
17). List the ename and sal is increased by 17% and expressed as no.of
dollars.
18). Produce the output of EMP table EMP_ AND JOB for ename and job.
19). Give a string of format ‘NN/NN’, verify that the first and last two
characters are numbers and that the middle character is ‘/’. Print the
expression ‘YES’ if valid, ‘NO’ if not valid. Use the following values to
test your solution is ’12/34’, ’01/1a’, ’99/98’.
21). Emps hired on or before 15th of any month are paid on the last Friday of
that month, those hired later 15th are paid on the first Friday of the
following month. Print a list of emps, their hiredate and the first pay
date. Sort on hiredate.
23). Check whether all the emps numbers are indeed unique.
29). List the emps whose salaries are less than 3500.
30). List the emps empno, ename, sal of all emp joined before 1 Apr 1981.
34). List the empno, ename, sal, job of emps with the ann.sal < 34000 but
receiving some comm, which should not greater than sal and the desg
should be SALESMAN working for dept 30.
36). List all the SALESMAN of the dept 30 whose comm. is more than the
salary.
39). List the emps empno, ename, job, sal of all emps.
46). List all the emps who are earning sal > 2500.
47). List all the emps who are working sinice 1st April 1982.
48). List the empno, ename, sal, daily sal of all emps.
53). List the emps who joined before 1985 and salary is more than 3000.
54). List the exp of grade 3 emps.
SUB QUERIES:
55). List the details of the emps whose salaries more than the employee
‘BLAKE’.
UPDATE:
61). Update the salary of ‘ALLEN’ with the highest paid emp of grade 2 and
transfer him to Blakes Dept and change the Mgr to Blake.
62). Increment the salaries by 2% and add a Comm. of 250 to the existing
Comm. and changing the manager to jobs of all ‘SALESMAN’ whose
salaries is more than or equal to 1000.
63). Replace the Sal of most senior ‘CLERK’ with the most senior employee
Sal of grade 3.
66). Increment the Sal of all the Clerks by Rs.200 and change their Mgr to
7654.
69). Transfer the emps to ANALYST Dept and give the Sal of SMITH plus
500 to those belongs to grade 3 working at New York or Dallas with an
exp >7y whose name should not be 4 chars.
72). Update Mgr 7788 to those are working under the Mgr 7839 & increase
the sal by 2%
74). Update the deptno of Sales dept for those emps working at Deptno 10.
75). Update the salary of SMITH with the highest paid salary emp of
SALESMAN more than 10 y exp.
76). Increment the sal of grade 2 emps by Rs.300.
77). Update the sal of ALLEN with the highest Sal of any CLERK belongs to
grade 2 or 3 working at CHICAGO or DALLAS and KING as
MANAGER.
78). Change the mgr to 7788 fro those working for the mgr 7369.
79). Add 250 to the comm. of all SALESMAN who are receiving some
commission.
80). Change the deptno of BLAKE to 30 and also change the job as
PRESIDENT with an increment in the Salary 8%.
82). Replace the Sal of SMITH with the highest paid SALESMAN with
exp>10 years.
84). Replace the Sal of ALLEN with the highest paid CLERK or NEW YORK
or CHICAGO.
DELETE:
86). Delete all the Managers who are working under KING with the Sal
ranging from 3500 to 4000 joined after seeming that
90). Delete the records where no.of emps in a particular dept is less than 3.
91). Delete the emps who joined in the company before 10 years back.
93). Delete the emps who joined in the month of Jan 1981.
94). Delete all the emps working under BLAKE with exp > 7 years.
97). Delete the emps who joined most recently under KING.
101). Delete the emps with exp < 4 and whose job is ending with ‘MAN’.
102). Delete the emps of SALES dept whose Salary ranging from 1500 to
3000.
103). Delete all Grade 2 and 3 emps of SALES dept and working at
‘BOSTON’ joined after 1983.
104). Delete the Information of JAMES.
106). Delete the information of emps who are working at CHICAGO with
exp<7 y & whose name is not having 4 chars.
107). Delete the emps whose salaries are lowest sals of their own dept.
108). Delete the emps who are senior to their own Mgrs.
109). Delete the emps who are at DALLAS and the emps are in dept 30.
113). Delete all SALESMAN with comm < 250 and also those are not
receiving comm.
JOINS:
115). List the total information of EMP table along with DNAME and LOC of
all the emps working under ‘ACCOUNTING” or ‘RESEARCH’ in the
asc DEPTNO.
116). List the EMPNO, ENAME, SAL, DNAME of all the ‘MANAGER’ and
‘ANALYST’ working in NEW YORK or DALLAS with an exp more
than 7 years without receiving the COMM are order by LOC.
117). Display the Empno, Ename, Sal , Dname, Loc, Deptno, Job of all emps
working at CHICAGO or working for ACCOUNTING dept with
ann.sal > 28000 but the Sal should not be=3000 or 2800 who doesn’t
belongs to the MANAGER and whose no is having a digit ‘7’ or ‘8’ in
3rd position in the asc order of Deptno and desc order of Job.
118). Display the total information of the emps along with GRADES in the
asc order of GRADE.
121). List the Empno, Ename, Dname, Grade, Exp and Annual Income of
emps working for Dept 10 or 20;
122). List all the information of emp with Loc and the Grade of all the emps
belong to the Grade range from 2 to 4 working at the Dept those are not
starting with char set ‘OP’ and not ending with ‘S’ with the 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.
123). List the details of the Depts along with Empno, Ename or without the
emps.
124). List the emps who are senior to their own Manager.
125). List the emps of Deptno 20 whose Jobs are same as Deptno 10.
126). List the emps whose Salary is same as FORD or SMITH in desc order of
Salary.
127). List the emps whose Jobs are same as MILLER or Sal is more than
ALLEN.
128). List the emps whose Sal is more than the total remuneration of the
SALESMAN.
129). List the emps who are senior to BLAKE working at CHICAGO &
BOSTON.
130). List the emps of Grade 3, 4 belongs to the dept ACCOUNTING and
RESEARCH whose Sal is more than ALLEN and exp more than
SMITH in the asc order of Exp.
132). List the most recently hired employee of Grade 3 belongs to the Loc
CHICAGO.
134). List the emps who are not working in ‘Sales’ dept.
135). List the emps Name, Dept, Sal& Comm for those whose Salary is
between 2000 and 5000 and Loc is CHICAGO.
136). List the emps whose Salary is greater than his Manager’s Salary.
137). List the Grade, Ename, for the Deptno 10 or 30 but Grade is not 4 while
they joined in the company before ’31-DEC-82’.
138). List the Ename, Job, Dname, Loc fro those who are working as a
MANAGERS.
139). List the emps whose Manager name is ‘Jones’ & also List the Manager
name.
140). List the Name and Salary of Ford if his Salary is equal to Hisal and his
Grade.
141). List the Name, Job, Dname, Mgrno, Salary, Grade Dept wise.
|
142). List the emps Name, Job and MGR without manager.
143). List the Name, Salary, Comm for those emps whose Net pay is greater
than or equal to any other employee Salary of the company.
144). List the emps whose Sal is less than his Manager but more than other
Managers.
145). List the Mgrs who are not working under ‘President’ but are working
under other Manager.
146). List the emps who joined in the company on the same date.
147). List the employee Name, Job, Annual Salary, Deptno, Dept Name, and
who earn 36000 a year and who are not CLERKs.
148). List the Name, Job and Salary of the emps who are not belonging to the
department 10 but who have the same Job or Salary as the emps of dept
10.
150). List the Empno, Ename, Deptno, and Loc of all emps.
151). List the Empno, Ename, Loc, Dname of the depts. 10 or 20.
152). List the Empno, Sal, Loc of emps working at CHICAGO,DALLAS with
an exp>6y.
153). List the emps along with Loc of those who belongs to DALLAS, NEW
YORK with Sal ranging from 2000 to 5000 joined in 1981.
156). List the emps with Loc & Grade of Accounting dept or the Location
DALLAS or CHICAGO with the grades 3 to 5 & exp > 6y.
160). List the emps whose job is same as either Allen or Sal is more than Allen
sal.
161). List the emps whose Sal is greater than Blakes Salary.
162). List the dept 10 emps whose Salary is more than Allen Salary.
163). List the Managers who are senior to King & who are Junior to Smith.
164). List the Empno, Ename, Loc, Sal, Dname of all emps belongs to King
dept.
165). List the emps whose grade is greater than the Miller.
166). List the emps who are belongs DALLAS or CHICAGO with the Grade
same as Adams or Exp more than Smith.
169). List the Empno, Ename, Sal, Exp, TA, HRA, DA and Gross and Dname
of all emps joined in the year 1981 in the Locs NEW YORK and
DALLAS with Sal < 4500.
170). List Empno, Ename, Sal, Dname, Loc of all emps working at DALLAS,
with the Sal should not more than 3500 in the desc order of Sal.
171). List the information of EMP along with Loc, employee working at Loc
which does not have a char ‘a’ with the annual Salary ranging from
20000 to 40000 without Comm.
172). List the Empno, Ename, Deptno and Dname of all emps belongs to
‘RESEARCH’ Dept.
173). List all the emps along with Location who belongs to Depts 10 or 20.
174). List the details of the emps whose Sal is more than Blakes Sal.
175). List the emps of Deptno 10 whose Jobs are same as any emp job of
deptno 20.
177). List the Empno, Ename, Sal, Grade of all emps who belongs to the grade
3 or 4.
178). List the Empno, Ename, Sal, Grade of all emps working for the Mgrs
7788, 7369, 7566.
179). List all the Grade 3 ‘ANALYSTs’ and ‘MANAGERs’ in the asc order of
Job.
180). List all Grade 3 emps working for RESEARCH dept along with Grade
and Dname.
181). List the emps working at ‘CHICAGO’ with the Job same as the emp of
DALLAS.
182). List the emps of NEW YORK whose Job is same as any emp belongs to
Grade 3.
183). List the details of the emps whose Jobs are same as FORD and BLAKE.
184). List the empno, ename, sal, deptno, loc of all emps working in
Accounting or Sales Dept.
185). List the unique Job of emps working at DALLAS in the desc order.
186). List the emps along with dname, those are working in location which is
not having a char ‘Y’ or blank space in the ename & exp > 15 y & does
not belongs the jobs President, Salesman in the asc order of exp.
187). List the empno, ename, annsal, job, loc of all emps working at
CHICAGO, DALLAS with an annsal between 16000 to 32000 & whose
job!=Analyst working with some Mgr joined in Jan to June & Nov –Dec
but not belongs to year 83 or 84 in the asc order of loc.
188). List the empno, ename, sal, total details of the dept where the emps sal >
¾ th of comm and working in dept which is not located in Boston,
Dallas & whose names are not having a char ‘Z’ or ‘TH’ or ‘LL’
together & sal is 4 – digit & it should not ending with 0 in the asc order
of loc.
189). List all Managers & Analysts of grade 3 – 5 with the exp 8 – 14 years in
the asc order of belongs to grade.
190). List the details of emps with dname, grade those who are working in
Accounting belongs to grade 3.
191). List the emps with exp & annsal of those belongs to grade 1,2,3 & desgs
as Clerks or Salesman at Chicago or New York working for the Mgr is
not ending with ‘9’.
192). List the emps whose sal is more than Jones sal.
194). List the emps along with dname whose dname is same as Allen.
196). List the emps empno, ename, sal, job, deptno, loc, grade of emps whose
grade is same as the emps who are working under Blake.
197). List the emps whose jobs are same as emps of job of dept 20.
198). List the emps whose jobs are not same as any employee of Sales dept.
199). List the emps whose sal is more than any emp of dept 10.
200). List the emps who are senior to all emps & who are Mgrs to others.
201). List the emps whose jobs are same as Ford or Blake.
202). List the common jobs of grade 1 and emps working at Chicago.
203).
*204). List the jobs of emps available in Chicago & not available in Dallas.
205). List those Managers who are getting the sal less than his own emps
Salary.
206). Find out the emps who joined in the company before their Managers.
208). List the employees of Dept 20 & 30 whose exp is more than any
employee of Dept 10.
209). Display the emps whose Grade is 3.
211). Display the emps who are in ‘SALES’ Dept not in Grade 3.
*212). Display the emps who do not have any persons working under them.
213). Display the Depts whose name starts with ‘S’ while the Loc name end
with ‘L’;
214). Display the emps whose job is not ‘Manager’ but they are Managers to
some other employees.
215). Display the details of all the emps who are subordinate to Blake.
216). List the employees who are working as Manager using correlated sub-
query.
*217). List the emps whose Manager Name is ‘Jones’ and also with their
Manager name.