💻 하나씩 차곡차곡/프로그래머스 (SQL)

[SUM, MAX, MIN/LEVEL3] 물고기 종류 별 대어 찾기 (MySQL)

뚜루리 2024. 10. 30. 00:00
728x90
320x100

MySQL

SELECT   A.ID
        , B.FISH_NAME
        , A.LENGTH
FROM FISH_INFO A, FISH_NAME_INFO B
WHERE A.FISH_TYPE = B.FISH_TYPE
AND( A.FISH_TYPE, A.LENGTH )  IN (SELECT FISH_TYPE, MAX(LENGTH)
                                    FROM FISH_INFO
                                    GROUP BY FISH_TYPE )
728x90
320x100