Module 5 Graded Lab 1
Module 5 Graded Lab 1
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;