Query List 31 to 35

1 min read

Query List

31. Query to display the Department Name, Location Name, No. of Employees and the average salary for all employees in that department. 

 Query 1: 

Select Dname, Location, count(*), AVG (Salary) from EMPLOYEE e,DEPARTMENT d where e.Dno=d.Dno group by d.Dname, d.Location;

OR

 SELECT d.Dname, d.Location, COUNT(*),AVG(e.Salary) FROM employee e, department d WHERE d.Dno = e.Dno GROUP BY d.Dname, d.Location; 

Output:


32. Query to display Name and Hire Date for all employees in the same dept. As Rupesh. 

 Query: 

Select Ename, Hire_date from EMPLOYEE where Dno = (select Dno from EMPLOYEE where Ename='Rupesh'); 

Output: 

33. Query to display the Employee No. And Name for all employees who earn more than the average salary. 

Query: 

Select Eno, Ename from EMPLOYEE where Salary>(select AVG(Salary)from EMPLOYEE); 

Output: 

34. Query to display Employee Number and Name for all employees who work in a department with any employee whose name contains a ‘T’.

 Query: 

Select Eno, Ename from EMPLOYEE where Dno IS NOT NULL AND Ename LIKE '%t%'; 

Output: 

35. Query to display the names and salaries of all employees who report to Kunal. 

 Query: 

Select Ename, Salary from EMPLOYEE where Manager = (select Eno from EMPLOYEE where Ename='Kunal');

 Output: 












You may like these posts

  • 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 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 List46. List all the employees who joined before or after 1981. Query: Select * from employee where to_char(hire_date,'YYYY') not in ('1981'); (OR)Select…
  • 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 List41. List the employees who joined on 25-JAN-81, 09-MAY-81, 05-NOV-81, 04- JUN-80 in asc order of seniority.  Query:Select * from employee where hire_date in ('2…
  • 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