题解 | #异常的邮件概率#

异常的邮件概率

https://www.nowcoder.com/practice/d6dd656483b545159d3aa89b4c26004e

方法一:子查询



# # 正常用户的id: 1,3,4    不正常用户的id为  2 ;则排除不正常用户的id
# send_id not in (select id from user where is_blacklist=1)
# and
# receive_id not in  (select id from user where is_blacklist=1)
# # 让你统计正常用户发送给正常用户邮件失败的概率    : 正常用户:发送失败的/发送总数
# round(sum(if(type="no_completed",1,0))/count(type),3)
# # 最后SQL语句为
select date ,round(sum(if(type="no_completed",1,0))/count(type),3) as p from email
where send_id not in (select id from user where is_blacklist=1)
and
receive_id not in  (select id from user where is_blacklist=1)
group by date
order by date;


方法二:评论区的连表查询

全部评论

相关推荐

12-18 22:04
已编辑
杭州电子科技大学 Java
程序员牛肉:我觉得是这样的,你现在有点病急乱投医了。你要问自己这样一个问题: 我找实习的目的是什么?为了挣钱还是增强个人实力?如果是为了挣钱那没得说,如果我是为了增强个人实习,那我异地去一个小厂实习真的有收益吗?这个收益是否大过我参加学校的项目或者自学?我记得你们杭电有那种实验室专门负责运维学校的项目的。 找实习只是一个手段而已,不要把他变成目的。不要病急乱投医。
实习简历求拷打
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务