sql/Advent of SQL 2025
SQL 문제 풀이 챌린지(1~5)
gooreumsea
2026. 1. 14. 02:59
저작권 문제로 인해, 직접 작성한 쿼리문만 공개.
1. 사랑에 대한 영화 찾기
https://solvesql.com/problems/movies-about-love/
SELECT
title,
year,
rotten_tomatoes
FROM movies
WHERE LOWER(title) LIKE "%love%"
ORDER BY rotten_tomatoes DESC, year DESC
2. 서울숲에 놀러 가기 좋은 날
https://solvesql.com/problems/good-days-for-a-seoulforest-picnic/
SELECT measured_at AS good_day
FROM measurements
WHERE pm2_5 <= 9
AND MONTH(measured_at) = 12
3. 펭귄의 종과 몸무게 조회하기
https://solvesql.com/problems/species-and-mass-of-penguins/
SELECT
species,
body_mass_g
FROM penguins
WHERE species IS NOT NULL
AND body_mass_g IS NOT NULL
ORDER BY body_mass_g DESC, species ASC
4. 12월 우수 고객 찾기
https://solvesql.com/problems/whales-of-december/
SELECT
customer_id
FROM records
WHERE DATE_FORMAT(order_date, "%Y-%m") = "2020-12"
GROUP BY customer_id
HAVING sum(sales) >= 1000
5. 스탬프를 찍어드려요
https://solvesql.com/problems/count-stamps/
SELECT
CASE
WHEN total_bill >= 25 THEN 2
WHEN total_bill >= 15 THEN 1
ELSE 0
END AS stamp,
COUNT(*) AS count_bill
FROM tips
GROUP BY stamp
ORDER BY stamp ASC