楼主: siciliana
跳转到指定楼层
上一主题 下一主题
收起左侧

[统计--就业] 一大波SQL面试题+solution+转换成Python/R的写法

   
🔗
zhongyujun222 2019-7-19 09:38:31 | 只看该作者
全局:
楼主,我又想了很久,我觉得第一题你写的output是有点问题,按照这道题的逻辑, output的结果应该是
2018-01-01 00:00:00        both        200        1
2018-01-01 00:00:00        desktop        200        2
2018-01-01 00:00:00        mobile        200        2
2018-01-02 00:00:00        both        0        0
2018-01-02 00:00:00        desktop        100        1
2018-01-02 00:00:00        mobile        100        1
回复

使用道具 举报

🔗
stella333fre 2019-7-24 10:23:21 | 只看该作者
全局:
感谢楼主分享~太有心啦!
回复

使用道具 举报

🔗
qmovision 2019-7-26 02:27:05 | 只看该作者
全局:
谢楼主分享~
回复

使用道具 举报

🔗
yoyohavefun 2019-7-26 07:53:30 | 只看该作者
全局:

手动点赞感谢好总结
回复

使用道具 举报

全局:
谢谢楼主的分享!
回复

使用道具 举报

🔗
ppl2018 2019-7-28 09:04:32 | 只看该作者
全局:
谢谢分享 很有用 手动点赞
回复

使用道具 举报

🔗
windfallll 2019-7-29 14:42:12 | 只看该作者
全局:
谢谢楼主分享!最近在看sql题但确实还没开始练sql转python/R
回复

使用道具 举报

🔗
sclmaomao 2019-7-29 22:25:21 | 只看该作者
全局:
想问一下楼主,Q3 SQL解法里面,为什么要用max()呢?
回复

使用道具 举报

🔗
borabora2020 2019-8-2 05:05:45 | 只看该作者
本楼:
全局:
手动点赞!!
回复

使用道具 举报

🔗
fiibb 2019-8-7 15:47:39 | 只看该作者
全局:
Q1:. 1point3acres
With channel_cnt as
(select date, member_id, count(distinct channel) channel_cnt from purch group by 1,2  having count(distinct channel) > 1)-baidu 1point3acres
Select *
From
(.
Select a.date, a.channel, sum(spend) total_spend, count(distinct member_id) total_members
From purch a
Left join channel_cnt b on (a.date = b.date and a.member_id != b.member_id) group by 1,2
Union all
Select a.date, ‘both’ as channel, sum(spend) total_spend, count(distinct member_id) total_members
From purch a
join channel_cnt b on (a.date = b.date and a.member_id = b.member_id) group by 1,2
) order by 1 . 1point 3acres
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表