문제
입력 코드
SELECT
ROUND(COUNT(DISTINCT player_id)/(SELECT COUNT(DISTINCT player_id) FROM Activity), 2) AS fraction
FROM Activity
WHERE (player_id, DATE_SUB(event_date, INTERVAL 1 DAY))
IN (
SELECT
player_id,
MIN(event_date) AS first_login
FROM Activity
GROUP BY player_id
)
코드 설명
#SELECT #ROUND #COUNT #DISTINCT #DATE_SUB #INTERVAL #MIN #GROUP BY
문제 출처
'SQL' 카테고리의 다른 글
#98. [LeetCode / MySQL] 1141. User Activity for the Past 30 Days I (0) | 2023.09.24 |
---|---|
#97. [LeetCode / MySQL] 2356. Number of Unique Subjects Taught by Each Teacher (0) | 2023.09.23 |
#95. [LeetCode / MySQL] 1174. Immediate Food Delivery II (0) | 2023.09.21 |
#94. [LeetCode / MySQL] 1193. Monthly Transactions I (0) | 2023.09.20 |
#93. [LeetCode / MySQL] 1211. Queries Quality and Percentage (0) | 2023.09.19 |