inblog logo
|
송승현의 블로그
    SQL문제풀기

    [SQL문제풀기]조건에 맞는 개발자 찾기

    프로그래머스 SQL 고득점 Kit
    송송승현's avatar
    송송승현
    Dec 09, 2024
    [SQL문제풀기]조건에 맞는 개발자 찾기
    Contents
    문제나의 해답해설

    문제

    school.programmers.co.kr
    https://school.programmers.co.kr/learn/courses/30/lessons/276034

    나의 해답

    select distinct d.ID, d.EMAIL, d.FIRST_NAME, d.LAST_NAME from DEVELOPERS as d join SKILLCODES as s where (s.name ='Python' or s.name = 'C#') and (d.skill_code & s.code) = s.code order by d.id asc

    해설

    • DEVELOPERS as d join SKILLCODES as s : DEVELOPERS 테이블과 SKILLCODES 테이블을 조인
    • where (s.name ='Python' or s.name = 'C#') : 스킬 코드 이름이 ‘Python’ 또는 ‘C#’인 경우
    • (d.skill_code & s.code) = s.code : 개발자의 스킬 코드와 SKILLCODES 테이블의 코드 간에 비트 AND 연산을 수행하여 일치하는 경우만
    • order by d.id asc : 개발자를 ID를 기준으로 오름차순
    Share article
    Contents
    문제나의 해답해설

    송승현의 블로그

    RSS·Powered by Inblog