查看: 3487| 回复: 33
跳转到指定楼层
上一主题 下一主题
收起左侧

有小伙伴一起刷SQL吗?

头像被屏蔽
提示: 作者被禁止或删除 内容自动屏蔽

上一篇:请问DS需要学爬虫吗!
下一篇:【打卡帖】BA转DS 进阶打卡
推荐
yanyi869 2018-8-31 06:13:42 | 只看该作者
全局:
一起讨论下这道题?https://www.hackerrank.com/challenges/challenges/problem

我的思路是用union
第一部分:找到所有count数相同但是hacker_id不同的hacker_id 排除掉-baidu 1point3acres
然后union: count数等于max(count) 的
. Χ
现在写得第一部分:
select h.hacker_id, h.name, count(h.hacker_id).

from hackers h left join challenges c on h.hacker_id=c.hacker_id

where h.hacker_id not in
(
select t1.hacker_id
    . Waral dи,
    from (select hacker_id, count(hacker_id) as count from  challenges group by hacker_id) t1, (select hacker_id, count(hacker_id) as count from  challenges group by hacker_id) t2
    where t1.hacker_id!=t2.hacker_id and t1.count=t2.count. 1point 3acres
)
group by h.hacker_id,h.name. Waral dи,
order by count(h.hacker_id) desc

这半部分的结果就不太对 这里返回的应该都是count数不同的 但是count为1的返回了很多 (其他count没有) 不知道小伙伴们有没有什么见解?
回复

使用道具 举报

推荐
Fishsh 2018-9-5 23:19:33 | 只看该作者
全局:
yanyi869 发表于 2018-8-31 06:13. 1point3acres.com
一起讨论下这道题?https://www.hackerrank.com/challenges/challenges/problem

我的思路是用union

Mine:

WITH data
AS
(
SELECT c.hacker_id as id, h.name as name, count(c.hacker_id) as counter
FROM Hackers h. ----
JOIN Challenges c on c.hacker_id = h.hacker_id
GROUP BY c.hacker_id, h.name
) ..
.--
SELECT id,name,counter
FROM data
WHERE
counter=(SELECT max(counter) FROM data) . From 1point 3acres bbs
OR
counter in (SELECT counter FROM data.google  и
GROUP BY counter
HAVING count(counter)=1 )
ORDER BY counter desc, id
回复

使用道具 举报

推荐
Fishsh 2018-8-30 23:46:56 | 只看该作者
全局:
I am using Hackerrank now.  
Yesterday Finished
   Basic Select
   Advanced Select
   Aggregation
Working on Join today! . ----

Maybe I should use Leetcode too? So we will be on the same page.

Sorry no Chinese on my laptop.....
回复

使用道具 举报

🔗
xuyuan0130 2018-8-28 09:55:31 | 只看该作者
全局:
SQL应该是数据科学最基础最简单的部分,我也想换个工作最近, 可以和你一起看看,巩固巩固
回复

使用道具 举报

🔗
juziqishui90 2018-8-28 15:20:43 | 只看该作者
全局:
加我一起学哈哈 wechat juziqishui90
回复

使用道具 举报

🔗
jerrytim 2018-8-28 21:32:04 | 只看该作者
全局:
报名一起学! Hackrank的SQL用过一点,用过另外一个比较冷门的叫PostgreSQL Exercises的
回复

使用道具 举报

🔗
crystalplaza 2018-8-29 02:11:53 | 只看该作者
全局:
报名一起刷啊,可以讨论讨论。我在刷 leetcode.
回复

使用道具 举报

🔗
sjhdsjhh 2018-8-29 03:38:56 | 只看该作者
本楼:
全局:
刷题报名!
回复

使用道具 举报

🔗
Fishsh 2018-8-29 05:14:44 | 只看该作者
全局:
报名一起!woking on Hackrank SQL now!
回复

使用道具 举报

🔗
BornWinner 2018-8-29 08:07:52 | 只看该作者
全局:
报名,一起吗? wechat yukeyang32
回复

使用道具 举报

🔗
管理元 2018-8-29 08:09:17 | 只看该作者
全局:
kenuo 发表于 2018-8-28 22:59
地里有人总结过FB和Linkedin的sql题目, 不知道楼主有兴趣么?

有兴趣啊。新手,还不知道你说的这个信息。感觉非常有用啊!能给个链接最好啦
回复

使用道具 举报

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

本版积分规则

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