bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1075. Project Employees I

1075. Project Employees I

Leetcode Solutions

Calculating Average Experience Years per Project

Algorithm

  1. Perform a LEFT JOIN between the Project and Employee tables on the employee_id column.
  2. Use the GROUP BY clause to group the results by project_id.
  3. Select the project_id and the average of experience_years for each group.
  4. Use the ROUND function to format the average to 2 decimal places.
  5. Return the project_id and the formatted average as average_years.

erDiagram
    Project {
        int project_id
        int employee_id
    }
    Employee {
        int employee_id
        varchar name
        int experience_years
    }
    Project ||--o{ Employee : ""

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...