我们需要找出至少在两天不同日期登录游戏的玩家 ID。可以通过对player_id进行分组,然后计算每个玩家不同日期的数量,最后筛选出数量大于等于 2 的玩家。 -- @lc app=leetcode.cn id=512 lang=sql-- Game Play AnalysisSELECTplayer_idFROMActivityGROUPBYplayer_idHAVINGCOUNT(DISTINCTevent_date)>=2; 1. 2. 3....
1INSERTINTOActivity (player_id, event_date)2VALUES3(1,'2018-01-01') ;45INSERTINTOActivity (player_id, event_date)6VALUES7(1,'2018-01-02') ;89INSERTINTOActivity (player_id, event_date)10VALUES11(2,'2018-01-01') ;1213INSERTINTOActivity (player_id, event_date)14VALUES15(2,'2019-03...
We define the install date of a player to be the first login day of that player. We also define day 1 retention of some date X to be the number of players whose install date is X and they logged back in on the day right after X, divided by the number of players whose install dat...
0511 Game Play Analysis I 80.8% Easy 0512 Game Play Analysis II 55.5% Easy 0513 Find Bottom Left Tree Value Go 61.5% Medium 0514 Freedom Trail 43.0% Hard 0515 Find Largest Value in Each Tree Row Go 61.1% Medium 0516 Longest Palindromic Subsequence 53.2% Medium 0517 Super Washing ...
Table: Activity 二、题目信息 查询每个用户首次登陆的日期所使用的设备。 Write a SQL query that reports thedevicethat is first logged in for each player. The query result format is in the following example: 查询结果 三、SQL 语句 3.1 联结 ...
My Solutions to Leetcode problems. All solutions support C++ language, some support Java and Python. Multiple solutions will be given by most problems. Enjoy:) 我的Leetcode解答。所有的问题都支持C++语言,一部分问题支持Java语言。近乎所有问题都会提供多个算
datediff(b.event_date,a.first_log_date) as time1 from ( select player_id, min(event_date) as first_log_date from Activity group by player_id )a left join ( select player_id, event_date from Activity group by player_id,event_date )b on a.player_id=b.player_id group by a.player...
题库 注册或登录 Plus会员 测试用例 测试结果 测试结果 智能模式 Case 1 [object Object] 该题目是 Plus 会员专享题 感谢使用力扣!您需要升级为 Plus 会员来解锁该题目 升级Plus 会员
1 人赞同了该文章 一、表信息 该表记录了游戏用户的行为信息,主键为(player_id, event_date)的组合。每一行记录每个游戏用户登录情况以及玩的游戏数(玩的游戏可能是0)。 (player_id, event_date) is the primary key of this table. This table shows the activity of players of some game. Each row is...
first_login) = 1 方法二:FIRST_VALUE() 窗口函数 SELECT ROUND(COUNT(DISTINCT b.player_id)/COUNT(DISTINCT a.player_id), 2) AS fraction FROM Activity AS a LEFT JOIN (SELECT player_id, FIRST_VALUE(event_date) OVER(PARTITION BY player_id ORDER BY event_date) AS first_login FROM Activity)...