Lab Exercise for Employee Data Analysis, Exercises of Computer Science

Instructions for various sql queries to analyze employee data, including calculating months worked, displaying salary statistics by job type, listing jobs in department 20, identifying employees with commissions, displaying department information, formatting employee information, and determining the number of employees with the same job. The queries are designed to be run in an sql environment.

Typology: Exercises

2020/2021

Uploaded on 06/19/2021

mad-man
mad-man 🇵🇰

3 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lab04 Exercise
[1] For each employee, display the employee’s name and calculate the number of months between today and
the date the employee was hired. Label the column MONTHS_WORKED. Order your results by the number of
months employed. Round the number of months up to the closest whole number.
[2] Display the highest, lowest, sum, and average salary of all employees for each job type. Label the columns
Maximum, Minimum, Sum, and Average, respectively. Round your results to the nearest whole number.
[3] Create a unique listing of all jobs that are in department 20. Include the location of the department in the
output.
[4] Write a query to display the employee name, department name and location, and job of all employees who
earn a commission.
[5] Write a query to display each department’s name, location, number of employees, and the average salary for
all employees in that department. Label the columns Department, Location, Number of People,
and Salary respectively. Round the average salary to two decimal places.
[6] Display each employee’s name, hire date, and salary review date, which is the first Monday after six months
of service. Label the column REVIEW. Format the dates to appear in the format similar to “Monday, the
Thirty-First of July, 2000.”
[7] Create a query to display the name and salary for all employees. Format the salary to be 15 characters long,
left-padded with $. Label the column SALARY.
[8] Write a query to display the number of people with the same job.
[9] Write a query to display the name, department number, department name and location for all employees.

Partial preview of the text

Download Lab Exercise for Employee Data Analysis and more Exercises Computer Science in PDF only on Docsity!

Lab04 Exercise

[1] For each employee, display the employee’s name and calculate the number of months between today and the date the employee was hired. Label the column MONTHS_WORKED. Order your results by the number of months employed. Round the number of months up to the closest whole number.

[2] Display the highest, lowest, sum, and average salary of all employees for each job type. Label the columns Maximum, Minimum, Sum, and Average, respectively. Round your results to the nearest whole number.

[3] Create a unique listing of all jobs that are in department 20. Include the location of the department in the output.

[4] Write a query to display the employee name, department name and location, and job of all employees who earn a commission.

[5] Write a query to display each department’s name, location, number of employees, and the average salary for all employees in that department. Label the columns Department, Location, Number of People, and Salary respectively. Round the average salary to two decimal places.

[6] Display each employee’s name, hire date, and salary review date, which is the first Monday after six months of service. Label the column REVIEW. Format the dates to appear in the format similar to “Monday, the Thirty-First of July, 2000.”

[7] Create a query to display the name and salary for all employees. Format the salary to be 15 characters long, left-padded with $. Label the column SALARY.

[8] Write a query to display the number of people with the same job.

[9] Write a query to display the name, department number, department name and location for all employees.