22 - 游戏玩法分析 IV(高频 SQL 50 题基础版)

22 - 游戏玩法分析 IV

  • 考点: 聚合函数

sql 复制代码
# 日期相加 date_add(min(event_date),INTERVAL 1 DAY) 
select 
    round(count(distinct player_id)/(select count(distinct player_id) from Activity),2) fraction  
from
    Activity 
where
    -- 如果日期加一天的数据能在表中查到,说明连续登录了两天
    (player_id,event_date) in 
    (select 
        player_id,date_add(min(event_date),INTERVAL 1 DAY) 
    from 
        Activity 
    GROUP BY
        player_id
     );
相关推荐
2501_945423542 小时前
用Matplotlib绘制专业图表:从基础到高级
jvm·数据库·python
2301_793804692 小时前
使用Python处理计算机图形学(PIL/Pillow)
jvm·数据库·python
哆啦A梦15888 小时前
Springboot整合MyBatis实现数据库操作
数据库·spring boot·mybatis
Zzzzmo_9 小时前
【MySQL】JDBC(含settings.xml文件配置/配置国内镜像以及pom.xml文件修改)
数据库·mysql
FirstFrost --sy10 小时前
MySQL内置函数
数据库·mysql
2401_8796938710 小时前
将Python Web应用部署到服务器(Docker + Nginx)
jvm·数据库·python
reembarkation10 小时前
光标在a-select,鼠标已经移出,下拉框跟随页面滚动
java·数据库·sql
eggwyw10 小时前
MySQL-练习-数据汇总-CASE WHEN
数据库·mysql
星轨zb10 小时前
通过实际demo掌握SpringSecurity+MP中的基本框架搭建
数据库·spring boot·spring security·mp
treacle田11 小时前
达梦数据库-配置本地守护进程dmwatcher服务-记录总结
数据库·达梦数据库·达梦数据库local数据守护