문제
각 도시의 부동산 유형에 대해 평균 욕실 수와 침실 수를 찾아 결과를 도시 이름과 부동산 유형과 함께 출력하세요.
테이블설명
예상결과
✏️ 풀이
SELECT city, property_type, AVG(bathrooms) AS n_bathrooms_avg, AVG(bedrooms) AS n_bedrooms_avg
FROM airbnb_search_details
GROUP BY 1, 2;
1. AVG() 를 이용해 bathrooms, bedrooms 평균 구하기
2. city, property_type 으로 group by
'[코딩테스트] > [SQL]' 카테고리의 다른 글
[StrataScratch - SQL] (Easy) Most Lucrative Products (0) | 2025.04.30 |
---|---|
[StrataScratch - SQL] (Easy) (0) | 2025.04.30 |
[StrataScratch - SQL] (Easy) MacBookPro User Event Count (0) | 2025.04.29 |
[StrataScratch - SQL] (Easy) Most Profitable Financial Company (0) | 2025.04.28 |
[StrataScratch - SQL] (Easy) Churro Activity Date (0) | 2025.04.28 |