[数据库SQL] [leetcode-511] 511. 游戏玩法分析 I

511. 游戏玩法分析 I

活动表 Activity:

±-------------±--------+

| Column Name | Type |

±-------------±--------+

| player_id | int |

| device_id | int |

| event_date | date |

| games_played | int |

±-------------±--------+

在 SQL 中,表的主键是 (player_id, event_date)。

这张表展示了一些游戏玩家在游戏平台上的行为活动。

每行数据记录了一名玩家在退出平台之前,当天使用同一台设备登录平台后打开的游戏的数目(可能是 0 个)。

查询每位玩家 第一次登录平台的日期。

查询结果的格式如下所示:

Activity 表:

±----------±----------±-----------±-------------+

| player_id | device_id | event_date | games_played |

±----------±----------±-----------±-------------+

| 1 | 2 | 2016-03-01 | 5 |

| 1 | 2 | 2016-05-02 | 6 |

| 2 | 3 | 2017-06-25 | 1 |

| 3 | 1 | 2016-03-02 | 0 |

| 3 | 4 | 2018-07-03 | 5 |

±----------±----------±-----------±-------------+

Result 表:

±----------±------------+

| player_id | first_login |

±----------±------------+

| 1 | 2016-03-01 |

| 2 | 2017-06-25 |

| 3 | 2016-03-02 |

±----------±------------+


Solution

相关推荐
晚风_END2 小时前
Linux|操作系统|最新版openzfs编译记录
linux·运维·服务器·数据库·spring·中间件·个人开发
dLYG DUMS3 小时前
DBeaver连接本地MySQL、创建数据库表的基础操作
数据库·mysql
kumat4 小时前
分享-搭建个人系统 MySelfSys
sql·系统
苍煜4 小时前
MySQL分库分表和ES到底怎么选?
数据库·mysql·elasticsearch
茉莉玫瑰花茶4 小时前
Qt 信号与槽 [ 1 ]
开发语言·数据库·qt
czlczl200209254 小时前
松散索引扫描/跳跃索引扫描
数据库·mysql·性能优化
夜猫逐梦6 小时前
【逆向经验】一篇文章讲透为什么CE搜不到Python游戏的内存值
开发语言·python·游戏
星马梦缘6 小时前
数据库作战记录 实验7、8
数据库·sql·oracle
安逸sgr6 小时前
Hermes Agent + Obsidian 打造第二大脑(六):分层记忆系统的设计逻辑——L0/L1/L2/L3 四层记忆详解
数据库·agent·知识库·hermes·hermesagent
小熊Coding7 小时前
童年游戏冒险岛(Python版本)
python·游戏·pygame