Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Q1. Tenure analysis: Table: employee Column Name Data Type Description employee_id Integer Unique identifier for each employee department Varchar The department of the employee job_level

Q1. Tenure analysis: Table: employee Column Name Data Type Description employee_id Integer Unique identifier for each employee department Varchar The department of the employee job_level Varchar The level of the job (e.g., Junior, Mid-level, Senior) employee_status Varchar The status of the employee (Active, Termed) hire_date Date The date the employee was hired term_date Date The date the employee left, NULL if currently employed

Task: 1. Write a SQL query to calculate the average tenure of active employees in each job level within each department. Assume today's date as the end date you need to calculate tenure for active employees.

2. Due to data error, there may be issues with term date and hire date. Write the issues that might occur in the date fields and how will you modify Task 1 to account for those conditions.

3. Write a SQL query to find the employee(s) in each department with the longest tenure, along with their tenure. Also, identify any employees whose tenure is more than two standard deviations above the average tenure for their department and job level.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students explore these related Algorithms questions