ID | Title | Difficulty | |
---|---|---|---|
Loading... |
1075. Project Employees I
Easy
LeetCode
Database
Problem
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.
Each row of this table contains information about one employee.
Code
SELECT p.project_id,
ROUND(AVG(e.experience_years), 2) AS average_years
FROM Project AS p
INNER JOIN Employee AS e
ON p.employee_id = e.employee_id
GROUP BY p.project_id
按 <- 键看上一题!
1070. Product Sales Analysis III
按 -> 键看下一题!
1076. Project Employees II