TCS Java Hackathon - Sql Hands-on
Q1. 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;
Q2. Display Department Details
select Dept_Id,Dept_Name from Department where Dept_Location='Ground Floor';
Q3. 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');
Q4. 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;
Q5. Find items not ordered
select distinct Item_Name from Items where Item_id not in(select distinct Item_Id from orders);
Comments
Post a Comment