Skip to content

[1주차] 이지영 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 15, 2024
Prev Previous commit
이지영: [SQL] 부모의 형질을 모두 가지는 대장균 찾기_240912
  • Loading branch information
yeongleej committed Sep 13, 2024
commit f505e21570ca036826c66e8832bd32ed81419a8f
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- 부모의 형질을 모두 가지는 대장균 찾기
-- https://school.programmers.co.kr/learn/courses/30/lessons/301647

SELECT C.ID, C.GENOTYPE, C.PARENT_GENOTYPE
FROM (
SELECT A.ID, A.PARENT_ID, A.GENOTYPE, B.GENOTYPE AS PARENT_GENOTYPE
FROM ECOLI_DATA as A
LEFT JOIN ECOLI_DATA as B
ON A.PARENT_ID = B.ID
) AS C
where (C.GENOTYPE & C.PARENT_GENOTYPE) = C.PARENT_GENOTYPE
ORDER BY C.ID