프로그래머스 SQL GROUP BY
·
독서/데이터베이스
고양이와 개는 몇 마리 있을까 # (1) SELECT ANIMAL_TYPE as TYPE, COUNT(ANIMAL_TYPE) as COUNT FROM ANIMAL_INS WHERE ANIMAL_TYPE IN ('Dog', 'Cat') GROUP BY ANIMAL_TYPE # (2) SELECT ANIMAL_TYPE, COUNT(ANIMAL_TYPE) as count FROM ANIMAL_INS GROUP BY ANIMAL_TYPE ORDER BY ANIMAL_TYPE 동명 동물 수 찾기 SELECT t1.NAME, t1.COUNT FROM (SELECT NAME, COUNT(NAME) as COUNT FROM ANIMAL_INS WHERE NAME IS NOT NULL GROUP BY NAME) as t..