Interview Questions/SQL/Project Employees I

Project Employees I

Preview mode. Log in to edit, run, submit, and save progress.

Medium

Project Employees I

You have two tables: Project and Employee. Each row in Project maps an employee to a project. Each employee has an experience_years value. Write a SQL query to report the average experience years of all employees on each project, rounded to 2 decimal places. Return the result in any order.

Examples

Example 1

Project 1: (3+2+1)/3 = 2.00. Project 2: (3+2)/2 = 2.50.

Approach hint

Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.

Common mistake

Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.

query.sql