SQL Hands on TCS Xplore Solution

Handson-1 Employee Count

select Departments.deptName,COUNT(Employees.eDeptId) From departments LEFT Join Employees on Departments.deptId=Employees.eDeptId Group By Departments.deptId,Departments.deptName Order by count(Employees.eDeptId) Desc, departments.deptName;

Handson -2 Display Department Details

select Dept_Id,Dept_Name from Department where Dept_Location=’Ground Floor’;

Handson – 3 Display non-Programmer Department name

select distinct Dept_name from Departments,Employees where Dept_ID=Emp_Dept_Id and Dept_name not in (select distinct Dept_name from Departments,Employees where Dept_id=Emp_Dept_Id and Emp_Skill like’Programmer’);

Handson – 4  Department wise Skill

select distinct Dept_name,Emp_skill from Departments,Employees where Dept_ID=Emp_Dept_Id order by Dept_Name desc,Emp_Skill;

Handson – 5 Find items not ordered

select distinct Item_Name from Items where Item_id not in(select distinct Item_Id from orders);

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top