티스토리 뷰
https://leetcode.com/problems/game-play-analysis-iv
Game Play Analysis IV - LeetCode
Can you solve this real interview question? Game Play Analysis IV - Table: Activity +--------------+---------+ | Column Name | Type | +--------------+---------+ | player_id | int | | device_id | int | | event_date | date | | games_played | int | +---------
leetcode.com
with cond as (
select
distinct player_id
, datediff(lead(event_date, 1) over (partition by player_id order by event_date), min(event_date) over (partition by player_id)) cond
from Activity
order by player_id, event_date
)
select
round(count(distinct c.player_id)/count(distinct a.player_id), 2) as fraction
from Activity a
left join cond c on a.player_id = c.player_id
and c.cond = 1
'프로그래밍연습 > SQL' 카테고리의 다른 글
[SQL]exchange-seats (0) | 2023.08.21 |
---|---|
[SQL]friend-requests-ii-who-has-the-most-friends (0) | 2023.08.20 |
[SQL]human-traffic-of-stadium (0) | 2023.08.18 |
[SQL]trips-and-users (0) | 2023.08.18 |
[SQL]employees-earning-more-than-their-managers (0) | 2023.08.17 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Lambda
- counter
- 확률
- 군고구마
- leatcode
- SQL
- 중앙값
- 평균
- neural network
- programmers
- 확률분포
- Python
- 뇌하수체선종
- 힙
- 쿠싱증후군
- 코딩테스트
- 분당서울대병원
- 사분위수
- 조건부확률
- 프로그래머스
- TensorFlow
- 상관관계
- 분산
- 상대도수
- hash
- 쿠싱
- 통계
- random forest
- 파이썬
- 뇌하수체
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함