[SQL] (join) 중복되는 결과가 있을까 생각해보기 (frontEnd개발자 찾기)

도리·2025년 2월 26일

문제

DEVELOPERS 테이블에서 Front End 스킬을 가진 개발자의 정보를 조회하려 합니다. 조건에 맞는 개발자의 ID, 이메일, 이름, 성을 조회하는 SQL 문을 작성해 주세요.
결과는 ID를 기준으로 오름차순 정렬해 주세요.

table
1. skillcodes
2. developers

내 코드

With Fe as (
Select code
From skillcodes 
Where category = 'front End')
Select d.id, d.email, d.first_name ,d.last_name
From developers d , Fe f
Where skill_code & f.code = f.code
order by d.id
  • test코드는 정답인데 채점결과 모두 틀려버렸다.

정답코드

  • group by 적용
With Fe as (
Select code
From skillcodes 
Where category = 'front End')
Select d.id, d.email, d.first_name ,d.last_name
From developers d , Fe f
Where skill_code & f.code = f.code
group by d.id, d.email, d.first_name ,d.last_name
order by d.id

틀린 이유

  • 한 개발자는 여러 언어 기술을 가질 수 있다.
  • 여러 프론트엔드 기술을 가진 한 개발자의 정보가 중복으로 나올 가능성이 있음...
  • 중복되는 결과가 있을까 항상 생각해보자.

사담.. 이런 사소한게 코테 합격자와 불합격자를 가르는 것이 아닐까?
슬슬 공고 시즌이고, 서류도 붙은게 없지만
이런 사소한 실수로 인해 감점된다면 너무 아쉬울 것 같다.ㅜㅜ

항상 경각심을 가지자.

profile
인공지능응용학과 졸업

0개의 댓글