0% found this document useful (0 votes)
5 views1 page

Module 5 Graded Lab 1

The document provides SQL queries for various employee-related data retrieval tasks. It includes queries to filter employees by name, department, and joining year, as well as to calculate counts and sums of salaries. Additionally, it demonstrates how to join tables to display department names alongside employee names.

Uploaded by

vinit121198
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 views1 page

Module 5 Graded Lab 1

The document provides SQL queries for various employee-related data retrieval tasks. It includes queries to filter employees by name, department, and joining year, as well as to calculate counts and sums of salaries. Additionally, it demonstrates how to join tables to display department names alongside employee names.

Uploaded by

vinit121198
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
You are on page 1/ 1

Write a query for the following situations:

1. To show the names of the employees whose name starts with 'B'.
2. To show the names of the employees belonging to the department having department id
2.
3. To calculate the number of records in the Employee table.
4. To calculate maximum StartSalary for the StartYear ‘2010’.
5. To show names of the employees and their starting salary sorted by StartSalary (from
higher to lower) who joined after 2010 (Your output must include the employees who
joined in 2010 as well).
6. To show a summarized StartSalary for each DepID.
7. To show department names and employee names belonging in each department. (Hint:
Join 2 tables)
8. To show names of the employee in the following departments: HR, Sales, and IT.

Answers:
1. SELECT * FROM employee WHERE EmpName LIKE 'B%';
2. SELECT EmpName FROM employee WHERE DepId = 2;
3. SELECT COUNT(*) FROM employee;
4. SELECT MAX(StartSalary) FROM employee WHERE StartYear = '2010';
5. SELECT DepId,StartSalary FROM employee;
6. SELECT SUM(StartSalary) FROM employee GROUPBY DepID;
7. SELECT EmpName FROM employee WHERE DepId = 2 OR DepId = 3 OR DepId = 4;

You might also like