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 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 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 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 List6. Query to display Employee Name and Department Number for the Employee No = E90. Query: Select Ename, Dno from EMPLOYEE where Eno='E90'; Output:7.…
  • 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 …
  • 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…

Post a Comment

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