select (distinct user_id)
from user_ord
where datediff(now(),ord_time)<=30
group by user_id
having sum(ord_amt)>5000
image.png
select new.user_type ,avg(new.pv_cnt) as avg_visit_by_type
from(select user_id,user_type,pv_cnt,cume_dist() over(partition by user_type order by pv_cnt ) percent
from user_visits) new
where new.percent>0.05
image.png
image.png
select mall_no,count_ord,count_good,count_user,rank() over(order by new.count_ord desc) as ord_rank)
(select mall_no,count(if(datediff(now(),order_time<20,1,0)) count_ord,count(distinct mall_good.good_no) count_good,count(distinct user_id) as count_user
from mall_goods left join order on mall_goods.goods_no=order.goods_no
group by mall_no) new
第四题
有三个袋子,一号袋子3红球7黑球,二号袋子8红2黑,三号袋子4红6黑,随机选一个袋子并从中取一个球,如果拿出红球,那么这个球来自三号袋子的概率 。
第五题
超市昨天的成交金额突然降了,怎么找到原因
网友评论