Skip to content

Commit 0385312

Browse files
committed
feat: add sql solution to lc problem: No.0550
No.0550.Game Play Analysis IV
1 parent cdb1240 commit 0385312

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

solution/0500-0599/0550.Game Play Analysis IV/README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,17 @@ Result table:
5656
### **SQL**
5757

5858
```sql
59-
59+
# Write your MySQL query statement below
60+
SELECT round( AVG( b.event_date IS NOT NULL ),2 ) fraction
61+
FROM
62+
(
63+
SELECT player_id
64+
,MIN( event_date ) AS event_date
65+
FROM activity
66+
GROUP BY player_id
67+
) a
68+
LEFT JOIN activity b
69+
ON a.player_id = b.player_id AND DATEDIFF( a.event_date, b.event_date ) = -1
6070
```
6171

6272
<!-- tabs:end -->

solution/0500-0599/0550.Game Play Analysis IV/README_EN.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,17 @@ Only the player with id 1 logged back in after the first day he had logged in so
5858
### **SQL**
5959

6060
```sql
61-
61+
# Write your MySQL query statement below
62+
SELECT round( AVG( b.event_date IS NOT NULL ),2 ) fraction
63+
FROM
64+
(
65+
SELECT player_id
66+
,MIN( event_date ) AS event_date
67+
FROM activity
68+
GROUP BY player_id
69+
) a
70+
LEFT JOIN activity b
71+
ON a.player_id = b.player_id AND DATEDIFF( a.event_date, b.event_date ) = -1
6272
```
6373

6474
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Write your MySQL query statement below
2+
SELECT round( AVG( b.event_date IS NOT NULL ),2 ) fraction
3+
FROM
4+
(
5+
SELECT player_id
6+
,MIN( event_date ) AS event_date
7+
FROM activity
8+
GROUP BY player_id
9+
) a
10+
LEFT JOIN activity b
11+
ON a.player_id = b.player_id AND DATEDIFF( a.event_date, b.event_date ) = -1

0 commit comments

Comments
 (0)