아아
셀프조인 하는 방법을 까먹어서
삽질을 했네..;;
셀프조인 어케하는지 암기하자
셀프조인 말고.. with절 사용해서 풂..
with parent as (
select ID, GENOTYPE
from ECOLI_DATA
)
-- 코드를 작성해주세요
select ECOLI_DATA.ID, ECOLI_DATA.GENOTYPE,
parent.GENOTYPE PARENT_GENOTYPE
from ECOLI_DATA inner join parent
on parent.ID = ECOLI_DATA.PARENT_ID
where ECOLI_DATA.GENOTYPE & parent.GENOTYPE = parent.GENOTYPE
order by ECOLI_DATA.ID
셀프조인
-- 코드를 작성해주세요
select me.ID, me.GENOTYPE, paren.GENOTYPE PARENT_GENOTYPE
from ECOLI_DATA me inner join ECOLI_DATA paren
on me.PARENT_ID = paren.ID
where me.GENOTYPE & paren.GENOTYPE = paren.GENOTYPE
order by ID
'알고리즘 > 프로그래머스' 카테고리의 다른 글
조회수가 가장 많은 중고거래 게시판의 첨부파일 조회하기 (0) | 2024.09.18 |
---|---|
미로 탈출 명령어 *** (0) | 2024.09.11 |
모의고사 (0) | 2024.08.30 |
기능개발 (0) | 2024.08.30 |
상담원 인원 **** (0) | 2024.08.27 |