Query List 21 to 25

1 min read

Query List

21. Query to display Name, Department Name and Department No for all the employees. 

Query:

 Select EMPLOYEE.Ename, DEPARTMENT.Dname, EMPLOYEE.Dno from EMPLOYEE inner join DEPARTMENT on EMPLOYEE.Dno=DEPARTMENT.Dno;

 OR 

Select e.Ename, d.Dname, e.Dno from EMPLOYEE e inner join DEPARTMENT d on e.Dno = d.Dno; 

Output:

22. Query to display Unique Listing of all Jobs that are in Department # 301. 

Query: 

Select DISTINCT Job_type from EMPLOYEE where Dno=301; 

Output: 

23. Query to display Name, Dept Name of all employees who have an ‘A’ in their name.

 Query: 

Select EMPLOYEE.Ename, DEPARTMENT.Dname from EMPLOYEE inner join DEPARTMENT on EMPLOYEE.Dno = DEPARTMENT.Dno where Ename like '%a%';

Output

24. Query to display Name, Job, Department No. And Department Name for all the employees working at the New Delhi location. 

 Query: 

Select EMPLOYEE.Ename, EMPLOYEE.Job_type, EMPLOYEE.Dno, DEPARTMENT.Dname from EMPLOYEE inner join DEPARTMENT on EMPLOYEE.Dno = DEPARTMENT.Dno where Location='New Delhi'; 

Output:

25. Query to display name and Employee no. along with their Manager’s Name and the Manager’s employee no.; Along with the Employee’s name who do not have a Manager. 

Query: 

SELECT e.Ename, e.Eno, d.Ename, d.Eno FROM Employee e LEFT OUTER JOIN Employee d ON e.Eno = d.Manager; 

Output: 












You may like these posts

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

Post a Comment

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