Your question is Advanced SQL for Ranking. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Hinge’s analytics team wants to review the first employees associated with each product project in alphabetical order. Write a PostgreSQL query that returns the top two employees per project based on last name and then first name.
employees_projects to employees using employee_id.project_id using ROW_NUMBER().last_name, then first_name, with employee_id as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| employee_idPK | INTEGER | Unique employee identifier |
| last_name | VARCHAR(80) | Employee surname |
| first_name | VARCHAR(80) | Employee given name |
| salary | NUMERIC(12,2) | Annual employee salary |
| department | VARCHAR(80) | Hinge department |
| Column | Type | Description |
|---|---|---|
| employee_id | INTEGER | Employee associated with the project |
| project_id | INTEGER | Hinge project identifier |