0% found this document useful (0 votes)
5 views2 pages

SQL Output Based Worksheet

The document presents a SQL output based worksheet containing employee data including their ID, name, department, gender, age, city, salary, and experience. It includes various SQL queries to retrieve specific information such as employee names and salaries, filtering by conditions like salary thresholds and department. Additionally, it provides aggregate functions to analyze employee data by department, including counts, averages, maximums, and sums of salaries.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

SQL Output Based Worksheet

The document presents a SQL output based worksheet containing employee data including their ID, name, department, gender, age, city, salary, and experience. It includes various SQL queries to retrieve specific information such as employee names and salaries, filtering by conditions like salary thresholds and department. Additionally, it provides aggregate functions to analyze employee data by department, including counts, averages, maximums, and sums of salaries.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Output Based Worksheet

EmpID Name Dept Gender Age City Salary Experience

101 Arun IT M 25 Chennai 35000 2

102 Banu HR F 30 Madurai 42000 6

103 Charan IT M 28 Chennai 50000 5

104 Divya Sales F 35 Coimbatore 55000 10

105 Ezhil HR M 29 Trichy 40000 4

106 Farah IT F 26 Salem 48000 3

107 Gokul Sales M 32 Chennai 60000 8

108 Hema IT F 31 Madurai 52000 7

109 Imran HR M 27 Chennai 39000 3

110 Jaya Sales F 29 Salem 45000 5

1. SELECT Name, Salary FROM Employee;

2. SELECT Name, Dept FROM Employee WHERE Salary > 45000;

3. SELECT Name, City FROM Employee WHERE Dept='IT' AND City='Chennai';

4. SELECT Name, Salary FROM Employee WHERE Age BETWEEN 28 AND 32;

5. SELECT Name, Dept FROM Employee ORDER BY Salary DESC;

6. SELECT Name, Salary FROM Employee ORDER BY Dept ASC, Salary DESC;

7. SELECT Dept, COUNT(*) FROM Employee GROUP BY Dept;

8. SELECT Dept, AVG(Salary) FROM Employee GROUP BY Dept;

9. SELECT Dept, MAX(Salary) FROM Employee GROUP BY Dept;

10. SELECT Dept, SUM(Salary) FROM Employee GROUP BY Dept HAVING


SUM(Salary)>130000;

11. SELECT Dept, COUNT(*) FROM Employee GROUP BY Dept HAVING COUNT(*)>=3;

12. SELECT AVG(Salary), MAX(Salary), MIN(Salary) FROM Employee;

13. SELECT Name, Salary AS Monthly_Salary, Salary*12 AS Annual_Salary


FROM Employee;

14. SELECT Name, Salary, Salary+5000 AS Revised_Salary FROM Employee;


15. SELECT Dept, AVG(Salary) AS AvgSalary FROM Employee GROUP BY Dept
HAVING AVG(Salary)>45000 ORDER BY AvgSalary DESC;

You might also like