Query List 51 to 55

2 min read

 Query List

51. Display the Employee no, Ename, Salary, Dname, Location, Department no, Job of all employees working at Tokyo or working for ACCOUNTING department with Annual Salary>28000, but the Salary should not be = 30000 or 28000 who doesn’t belongs to the Manager and whose eno is having a digit ‘7’ or ‘8’ in 3rd position in the ascending order of Dno and desc order of job. 

 Query: 

Select E.eno, E.ename, E.salary, D.dname, D.location, E.dno, E.job_type from employee E, department D where (D.location = 'Tokyo' or D.dname = 'Accounting') and E.dno=D.dno and E.eno in (select E.eno from employee E where (12 * E.salary) > 28000 and E.salary not in (30000, 28000) and E.job_type != 'Manager' and ( E.eno like '__7' or E.eno like '__8')) order by E.dno asc , E.job_type desc; 

 Output: 

No data found.

 Outer 

Query:

 Select E.eno, E.ename, E.salary, D.dname, D.location, E.dno, E.job_type from employee E, department D where (D.location = 'Tokyo' or D.dname = 'Accounting') and E.dno = D.dno; 

Output:


Inner Query: 

 Select E.eno from employee E where (12 * E.salary) > 28000 and E.salary not in (30000, 28000) and E.job_type != 'Manager' and ( E.eno like '__7' or E.eno like '__8');

 Output: 


52. List the employees who are senior to Karanveer working at Paris & Beijing. 

 Query: 

Select * from employee e, department d where d.location in ('Paris', 'Beijing') and e.dno = d.dno and e.hire_date < (select e.hire_date from employee e where e.ename = 'Karanveer'); 

Output:



53. List the employees whose Jobs are same as Manish or Salary is more than Amit.

 Query:

 Select * from employee where job_type = (select job_type from employee where ename = ‘Manish’) or salary > (Select salary from employee where ename = ‘Amit’); 

 Output:


54. List the Employees whose Salary is greater than the total remuneration of the SALESMAN.  

Query: 

Select * from employee where salary > (Select sum(nvl2 (commission, salary + commission, salary)) from employee where job_type = 'Salesman'); 

Output:


Note: NVL2 lets you determine the value returned by a query based on whether a specified expression is null or not null. If expr1 is not null then NVL2 returns expr2.


55. List the employees whose jobs same as Sameer or Arjun. 

 Query: 

Select * from employee where job_type in (select job_type from employee where ename = 'Sameer' or ename = 'Arjun'); 

(OR)

 Select * from employee where job_type in (select job_type from employee where ename in ('Sameer', 'Arjun'));

Output 











You may like these posts

  •  Query List16. Query to display Name, Hire Date and Salary Review Date which is the 1st Monday after six months of employment. Query: Select Ename, Hire_date, Salar…
  • Query List36. Query to display the department no, name and job for all employees in the Sales department.  Query: Select e.Dno, e.Ename, e.Job_type from EMPLOYEE e,…
  • Query List26. Query to display Name, Dept No. and Salary of any employee whose department No. and Salary match both the department no. and the salary of any employee who earns a …
  •  Query List11. Query to display the Name, Salary and Commission for all the employees who earn commission. Sort the data in descending order of Salary and Commission. Q…
  • Query List31. Query to display the Department Name, Location Name, No. of Employees and the average salary for all employees in that department.  Query 1: Select Dn…
  • Query List21. Query to display Name, Department Name and Department No for all the employees. Query: Select EMPLOYEE.Ename, DEPARTMENT.Dname, EMPLOYEE.Dno from EMPLOYEE …

Post a Comment

© 2025DBMS. The Best Codder All rights reserved. Distributed by