Query List 26 to 30

1 min read

Query List

26. 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 commission.

Query: 

SELECT Ename, Dno, Salary FROM Employee Where (Dno, Salary) IN (Select Dno, Salary FROM Employee Where Commission IS NOT NULL); 

Output: 


Query to display Name, Dept No. and Salary of any employee whose Salary match the salary of any employee who earns a commission. 

Query:

 SELECT Ename, Dno, Salary FROM Employee Where Salary IN (Select Salary FROM Employee Where Commission IS NOT NULL);

 Output: 

Query to display Name, Dept No. and Salary of any employee whose department No. match the department no. of any employee who earns a commission.

 Query:

SELECT Ename, Dno, Salary FROM Employee Where Dno IN (Select Dno FROM Employee Where Commission IS NOT NULL); 

Output: 


27. Query to display Name and Salaries represented by asterisks, where each asterisk (*) signifies ₹10,000. 

 Query 1: 

Select Ename||''||rpad('*',(round(Salary/10000)),'*')"Employee and their Salary" from EMPLOYEE; 

Query 2:

 Select Ename||''||rpad('*',(FLOOR(Salary/10000)),'*')"Employee and their Salary" from EMPLOYEE;

Output:

Note: In above table each * represents 10,000 rupees.

28. Query to display the Highest, Lowest, Sum and Average Salaries of all the employees. 

 Query: 

 Select max(Salary), min(Salary), sum(Salary), avg(Salary) from EMPLOYEE;

Output: 


29. Query to display the number of employees performing the same Job type functions. 

 Query: 

Select Job_type, count(*) from EMPLOYEE group by Job_type; 

Output: 

30. Query to display the no. of managers without listing their names. 

Query: 

Select count(distinct Manager) from EMPLOYEE;

Output:

 


You may like these posts

  • 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 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 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 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 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,…

Post a Comment

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