SQLPRACQUEST-SelectQueryWithSoln
SQLPRACQUEST-SelectQueryWithSoln
SELECT QUERY
Given a table Employee(EID, EName, DeptNo, Salary, City) and Department(DeptNo, DName) write
the queries for the following situations:-
3. Display the Details of the Employees who are working in Kolkata or Chennai
4. Display the Name and Salary of the Employees whose name has 3rd last Letter as o. (Eg. Ashutosh,
Santosh, Anoop, Swaroop etc.)
5. Display the EID, EName and DName from Employee and Department tables.
6. Display the EName and DName from Employee and Department for Employees who earn more than
50000 and are posted in 'Mumbai'
7. Display the Total Number of Employees in the Employee Table who are working in Delhi
8. Display the Average Salary of Each Department along with the DeptNo.
9. Arrange the Employees working in DeptNo 101 in Descending Order of their Salaries.
10. Display the Maximum Salary of Each Department for Departments which have more than 5
employees working in them.
11. Count the number of Employees working in each department whose names start with "A"
12. Find the Total Salary of Employees in Each Department which has less than 10 employees from
either "Mumbai" or "Chennai"
13. Find the No of Employees working in each city whose name contains "SH" and minimum salary in the
City is more than 25000. Arrange them in ascending order of the City.
14. Find the City wise Total Salary of employees for Employees working in "Physics" or "Chemistry"
Department, and earns more than 5000 and no of employees in the City is not less than 6 and arrange
them in Descending order of the No of Employees in each city.
ANSWERS
ON E.DeptNo = D.DeptNo
GROUP BY DeptNo;
GROUP BY DeptNo
GROUP BY DeptNo;
GROUP BY DeptNo
GROUP BY City
ORDER BY City;
ON E.DeptNo = D.DeptNo
GROUP BY City