<aside> 💡
This project involves analyzing the experience levels of employees associated with various projects. The goal is to calculate the average years of experience for all employees working on each project, rounded to two decimal places. The project demonstrates proficiency in SQL joins , aggregate functions, and data grouping.
</aside>
project_id, employee_id).The task was to determine the average experience of employees for each project, rounded to two decimal places.
The query calculates the average years of experience for employees in each project by joining the Project and Employee tables and grouping the results by project_id.
SELECT p.project_id, ROUND(AVG(e.experience_years), 2) AS average_years
FROM Project p
JOIN Employee e ON p.employee_id = e.employee_id
GROUP BY p.project_id;
JOIN Employee e ON p.employee_id = e.employee_id combines the Project and Employee tables to associate each project with employee details.AVG(e.experience_years) calculates the average years of experience for employees in each project.ROUND(..., 2) rounds the result to two decimal places.GROUP BY p.project_id ensures the average is calculated separately for each project.Project Table: