PostgreSQL 풀이 | Data Science Skills

2025. 3. 7. 15:46·SQL

문제 1.  Data Science Skills

Given a table of candidates and their skills, you're tasked with finding the candidates best suited for an open Data Science job. You want to find candidates who are proficient in Python, Tableau, and PostgreSQL.

Write a query to list the candidates who possess all of the required skills for the job. Sort the output by candidate ID in ascending order.

https://datalemur.com/questions/matching-skills

 

LinkedIn SQL Interview Question | DataLemur

LinkedIn SQL Interview Question: Write a query to find candidates with matching skills.

datalemur.com


💡 문제 풀이 

`내 풀이`

소요 시간 08:00

  • 정답은 맞았는데 COUNT(candidate_id)= 3이 오류의 여지가 있을 것 같다.
SELECT candidate_id
FROM candidates
WHERE skill IN ('Python', 'Tableau', 'PostgreSQL')
GROUP BY candidate_id
HAVING COUNT(candidate_id) = 3
ORDER BY candidate_id ASC;

`더 나은 풀이`

  • HAVING 조건을 제대로 걸기
SELECT candidate_id
FROM candidates
WHERE skill IN ('Python', 'Tableau', 'PostgreSQL')
GROUP BY candidate_id
HAVING COUNT(candidate_id) = 3  -- 각 후보자가 정확히 3개 기술(Python, Tableau, PostgreSQL)있는 경우만 선택
ORDER BY candidate_id ASC;

💯결과

 

 

'SQL' 카테고리의 다른 글
  • PostgreSQL 풀이 | Highest-Grossing Items
  • PostgreSQL 풀이 | Histogram of Tweets
  • PostgreSQL 풀이 | Unfinished Parts
  • PostgreSQL 풀이 | Laptop vs. Mobile Viewership (CASE문과 집계함수, FILTER)
초담
초담
4년차 마케터입니다
  • 초담
    그로스마케터의 기록
    초담
  • 전체
    오늘
    어제
  • 글쓰기 관리
    • 분류 전체보기 (117)
      • Data Analytics Project (3)
      • SQL (55)
      • Python (43)
      • GA4 (0)
      • Tableau (8)
      • 아티클 스터디 (7)
  • 인기 글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.2
초담
PostgreSQL 풀이 | Data Science Skills
상단으로

티스토리툴바