1075. Project Employees I LeetCode Solution
In this guide, you will get 1075. Project Employees I LeetCode Solution with the best time and space complexity. The solution to Project Employees I problem is provided in various programming languages like C++, Java, and Python. This will be helpful for you if you are preparing for placements, hackathons, interviews, or practice purposes. The solutions provided here are very easy to follow and include detailed explanations.
Table of Contents
- Problem Statement
- Complexity Analysis
- Project Employees I solution in C++
- Project Employees I solution in Java
- Project Employees I solution in Python
- Additional Resources
Problem Statement of Project Employees I
Table: Project
+————-+———+
| Column Name | Type |
+————-+———+
| project_id | int |
| employee_id | int |
+————-+———+
(project_id, employee_id) is the primary key of this table.
employee_id is a foreign key to Employee table.
Each row of this table indicates that the employee with employee_id is working on the project with project_id.
Table: Employee
+——————+———+
| Column Name | Type |
+——————+———+
| employee_id | int |
| name | varchar |
| experience_years | int |
+——————+———+
employee_id is the primary key of this table. It’s guaranteed that experience_years is not NULL.
Each row of this table contains information about one employee.
Write an SQL query that reports the average experience years of all the employees for each project, rounded to 2 digits.
Return the result table in any order.
The query result format is in the following example.
Example not found
Constraints not found
Complexity Analysis
- Time Complexity: Google AdSense
- Space Complexity: Google Analytics
1075. Project Employees I LeetCode Solution in C++
SELECT
Project.project_id,
ROUND(AVG(Employee.experience_years), 2) AS average_years
FROM Project
INNER JOIN Employee
USING (employee_id)
GROUP BY 1;
/* code provided by PROGIEZ */
1075. Project Employees I LeetCode Solution in Java
N/A
// code provided by PROGIEZ
1075. Project Employees I LeetCode Solution in Python
N/A
# code by PROGIEZ
Additional Resources
- Explore all LeetCode problem solutions at Progiez here
- Explore all problems on LeetCode website here
Happy Coding! Keep following PROGIEZ for more updates and solutions.