https://platform.stratascratch.com/coding/10156-number-of-units-per-nationality?code_type=3
WITH UNDER_30 AS (
SELECT DISTINCT(host_id), nationality
FROM airbnb_hosts
WHERE age < 30
)
select nationality, COUNT(*)
FROM UNDER_30
LEFT OUTER JOIN airbnb_units
ON airbnb_units.host_id = UNDER_30.host_id
WHERE airbnb_units.unit_type = "apartment"
GROUP BY nationality
ORDER BY COUNT(*) DESC;
|
cs |
'프로그래머스' 카테고리의 다른 글
[프로그래머스] 124 나라의 숫자 [C/C++] (0) | 2022.06.23 |
---|---|
프로그래머스 - 이중우선순위큐 [C/C++] (0) | 2022.06.20 |
프로그래머스 - 등굣길 [C/C++] (0) | 2022.06.20 |
프로그래머스 - 정수 삼각형 [C/C++] (0) | 2022.06.20 |
프로그래머스 - 완주하지 못한 선수 [C/C++] (0) | 2022.06.18 |