SQL166大厂面试真题

统计新用户的方法,判断用户最早登陆日期是否等于当前日期,是记为1。sum(if(new_user_time=time,1,0))

select time, count(distinct t1.uid)dau, round(sum(if(new_user_time=time,1,0))/count(distinct t1.uid) ,2)from

(

    select uid, date(in_time) as time from tb_user_log union

    select uid, date(out_time) as time from tb_user_log

)t1 join

(

    select uid, min(date(in_time))new_user_time from tb_user_log

    group by uid

)t2 using(uid)

group by time

order by time ASC

#笔试#
全部评论

相关推荐

可以不说话:笔试a了3道半,今天说是挂了😭😭
投递汇丰科技等公司7个岗位
点赞 评论 收藏
分享
野猪不是猪🐗:我assume that你must技术aspect是solid的,temperament也挺good的,however面试不太serious,generally会feel style上不够sharp
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务