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 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 List51. Display the Employee no, Ename, Salary, Dname, Location, Department no, Job of all employees working at Tokyo or working for ACCOUNTING department with Annual…
  • 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 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 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