분류 전체보기167 Students and Examinations 문제+---------------+---------+| Column Name | Type |+---------------+---------+| student_id | int || student_name | varchar |+---------------+---------+student_id is the primary key (column with unique values) for this table.Each row of this table contains the ID and the name of one student in the school. Table: Subjects+--------------+---------+| Column Name | Type |+-----------.. 2025. 7. 23. 세션 유지 시간을 10분으로 재정의하기 https://solvesql.com/problems/redefine-session-2/ 정답 쿼리WITH event_party AS (SELECT user_pseudo_id, ga_session_id, event_timestamp_kst, LAG(event_timestamp_kst) OVER(ORDER BY event_timestamp_kst) AS prev_event, CASE WHEN LAG(event_timestamp_kst) OVER(ORDER BY event_timestamp_kst) IS NULL OR (julianday(event_timestamp_kst) - julianday(LAG(event_times.. 2025. 7. 14. 스테디셀러 작가 찾기 https://solvesql.com/problems/find-steadyseller-writers/ https://solvesql.com/problems/find-steadyseller-writers/ solvesql.comWITH TEMP AS( SELECT DISTINCT author, year, DENSE_RANK() OVER (PARTITION BY author ORDER BY year) AS NUM FROM books WHERE Genre = 'Fiction'), TEMP2 AS( SELECT *, year - NUM AS straight FROM TEMP)SELECT .. 2025. 7. 11. 세션 재정의하기 https://solvesql.com/problems/redefine-session/ https://solvesql.com/problems/redefine-session/ solvesql.com WITH session_split AS( SELECT user_pseudo_id, event_timestamp_kst, LAG(event_timestamp_kst) OVER (ORDER BY event_timestamp_kst) AS prev_event, CASE WHEN LAG(event_timestamp_kst) OVER (ORDER BY event_timestamp_kst) IS NULL OR (juliand.. 2025. 7. 10. 카테고리 별 매출 비율 https://solvesql.com/problems/revenue-pct-per-category/ https://solvesql.com/problems/revenue-pct-per-category/ solvesql.com LV.5 인데 LV.4 보다 쉬운 것 같다.WITH TEMP AS( SELECT DISTINCT category, sub_category, ROUND(SUM(sales) OVER(PARTITION BY sub_category), 2) AS sales_sub_category, ROUND(SUM(sales) OVER(PARTITION BY category), 2) AS sales_category, ROUND(SUM(sales) OVER(),.. 2025. 7. 10. 폐쇄할 따릉이 정류소 찾기 1 https://solvesql.com/problems/find-unnecessary-station-1/ https://solvesql.com/problems/find-unnecessary-station-1/ solvesql.com SELECT S.station_id, S.nameFROM station S LEFT JOIN station near_s ON S.station_id != near_s.station_idWHERE S.updated_at = 5 주목할 점공식 보다 중요한건 JOIN 부분 같다. JOIN에서 조건이 불일치하는 공식은 처음 써보는데 앞으로 유용할 것 같다. 2025. 7. 7. 이전 1 2 3 4 ··· 28 다음