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:
Output: