-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmost_optimal_skill.sql
More file actions
24 lines (24 loc) · 886 Bytes
/
most_optimal_skill.sql
File metadata and controls
24 lines (24 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
Insights from demand and salary data to pinpoint skills that are both in high demand and have salaries
Group by skill_id, guarantees:
- No duplicates
- No collisions
- Clean grouping
- Correct aggregation of demand and salary
But group by skills we can merge different skills and there can be duplicates
*/
SELECT skills_dim.skill_id,
skills_dim.skills,
COUNT(skills_job_dim.job_id) AS demand_count,
ROUND(AVG(salary_year_avg), 0) AS avg_salary
FROM job_postings_fact
INNER JOIN skills_job_dim ON job_postings_fact.job_id = skills_job_dim.job_id
INNER JOIN skills_dim ON skills_job_dim.skill_id = skills_dim.skill_id
WHERE job_title_short = 'Data Engineer'
AND salary_year_avg IS NOT NULL
AND job_work_from_home = True
GROUP BY skills_dim.skill_id
HAVING COUNT(skills_job_dim.job_id) > 10
ORDER BY avg_salary DESC,
demand_count DESC
LIMIT 30;