Calculate Average Employee Tenure By Department
Find the average employee tenure by department.
sql
SELECT department, AVG(DATEDIFF(CURRENT_DATE, hire_date)) AS average_tenure_days FROM employees GROUP BY department;
This query calculates the average tenure in days for each department by finding the difference between the current date and the hire_date for each employee, grouped by their respective department.
PromptDB can make mistakes. Please double-check responses.