Query List 21 to 25

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: 












Post a Comment

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