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.
Assumption:
- There are no duplicates in the candidates table.
candidates Table:
Column | NameType |
candidate_id | integer |
skill | varchar |
candidates Example Input:
candidate_id | skill |
123 | Python |
123 | Tableau |
123 | PostgreSQL |
234 | R |
234 | PowerBI |
234 | SQL Server |
345 | Python |
345 | Tableau |
Example Output:
candidate_id |
123 |
Explanation
Candidate 123 is displayed because they have Python, Tableau, and PostgreSQL skills. 345 isn't included in the output because they're missing one of the required skills: PostgreSQL.
The dataset you are querying against may have different input & output - this is just an example!
p.s. give the hints below a try if you're stuck and don't know where to start!
SELECT candidate_id
FROM candidates
WHERE skill IN ('Python', 'Tableau', 'PostgreSQL')
GROUP BY candidate_id
HAVING COUNT(DISTINCT skill) = 3;
'SQL' 카테고리의 다른 글
SQL 라이브 코테 뽀개기 Day2: Unfinished Parts (0) | 2025.03.06 |
---|---|
SQL 라이브 코테 뽀개기 Day2: Page With No Likes (0) | 2025.03.06 |
라이브 코딩테스트 뽀개기 Day1: Histogram of Tweets (0) | 2025.03.06 |
QCC 5회차 오답 (0) | 2025.03.02 |
SQL 코드카타: Rising Temperature (0) | 2025.02.13 |