问题:mysql报错提示 Error Code: 1046. No database selectedSelect the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar.解决方法:1,首先看一下这个ERROR报错提示是什么意思? 英语看不懂,翻译,中英对照多看看,时间长了就记
My SQL 中:Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement这是因为在mysql中如果想要导入外部格式的数据文件,比如说csv文件,就需要先把这些文件放到mysql认为的安全路径下,才能上传成功。这也是出于对用
当over中指定了分区,排序,但是没有指定滑动窗口范围时,默认基于排序字段记录值范围来计算(当前分区内的第一行到当前行(排序字段)取值范围内的记录)#1,按顺序对每一个排序字段记录值对应的多行数据做聚合运算#2, 在同一个分区下,排序字段记录值相同时,不累加,这些记录行会给同一个聚合值, 到新的排序字段记录值出现时,会自动累加上一个聚合值.
-- 4.6 各分类用户数量和占比, 销售贡献额和贡献额占比,以及累计销售贡献额和累计贡献额占比#方法一select 用户价值分类, count(user_id) 人数 ,count(user_id)/ (select count(user_id) 总人数 from RFM1) 人数占比, sum(M) 销售贡献额, sum(M)/ (select sum(M) 总销售额 from RFM1)
-- 4.5 各分类用户数量和占比, 销售贡献额和贡献额占比 select 用户价值分类, count(user_id) 人数 , count(user_id)/ (select count(user_id) 总人数 from RFM1) 人数占比, sum(M) 销售贡献额 , sum(M)/ (select sum(M) 总销售额 from RFM1) 销售
-- 4.5 RFM用户价值create VIEW RFM1 AS select *,case when R程度='高' and F程度='高' and M程度='高' then '重要价值用户' when R程度='高' and F程度='低' and M程度='高' then '重要发展用户' #重要发掘, 提高F when R程度='低' and F程度='高' and M程
-- 4.4 RFM重要程度select *, if(R评分>3.5984,'高','低') as R程度, if(F评分>2.1039,'高','低') as F程度, if(M评分>2.2051,'高','低') as M程度from (select user_id,timestampdiff(day,max(日期),'2014-12-19') as R,co
-- 4.3 RFM均值selectavg(R评分) as R均值,avg(F评分) as F均值,avg(M评分) as M均值from(selectuser_id,case when timestampdiff(day,max(日期),'2014-12-19')
-- 4.2 RFM评分select user_id, timestampdiff(day,max(日期),'2014-12-19') as R, count(*) as F, sum(amount) as M, case when timestampdiff(day,max(日期),'2014-12-19')
-- 4.用户价值分析-- 4.1 每个用户消费时间间隔、消费频次、消费金额select user_id, max(日期) as 最近一次消费时间, timestampdiff(day,max(日期),'2014-12-19') as R, count(*) as F, sum(amount) as Mfrom userbehavior_newwhere behavior
-- 练习(荣威):查询每一家门店销售额从高到低累积占比前70%的商品create table store_sales_info( id int primary key, store_id int, order_id int, item_id int, sales decimal(10,2), qty int);insert into store_sales_i
-- 3.3 产品贡献定量分析(帕累托分析)##累积销售额占比=累积销售额/总销售额select *from (select item_category,sum(amount) as 销售额,sum(sum(amount)) over(order by sum(amount) desc) as 累积销售额,#当over中指定了排序,但是没有指定分区和指定滑动窗口范围时,默认计算当
-- 练习(得昂):查询每门课程的前三名:课程,第一名(姓名+分数),第二名(姓名+分数),第三名(姓名+分数)create table t_stu_profile(stu_id varchar(10) primary key,stu_name varchar(10),gender varchar(10),age int,class_id varchar(10) not null);create
-- 3.2.3 每日浏览—加购—购买的转化率select 日期, sum(if(behavior_type='pv',用户数,0)) as 浏览人数, sum(if(behavior_type='cart',用户数,0)) as 加购人数, sum(if(behavior_type='buy',用户数,0)) as 购买人数, sum(if(behavior_type=
-- 3.2.2 浏览—收藏-加购—购买的转化率selectbehavior_type,count(distinct user_id) as 用户数,lag(count(distinct user_id),1) over(order by if(behavior_type='pv',1,if(behavior_type='fav',2,if(behavior_type='cart',3,4))))
-- 3.2.1 浏览—加购—购买的转化率select behavior_type, count(distinct user_id) as 用户数, lag(count(distinct user_id),1) over(order by if(behavior_type='pv',1,if(behavior_type='fav',2,if(behavior_type='cart',
-- 3.2 行为转化分析(转化率=当前行为用户数/上一行为用户数)select behavior_type, count(distinct user_id) as 用户数, lag(count(distinct user_id),1) over(order by if(behavior_type='pv',1,if(behavior_type='fav',2,if(behavior
-- 3.1.3 练习:每小时PV、UV、人均浏览量、成交量、成交额select 小时, sum(behavior_type='pv') as 浏览量, count(distinct user_id) as 访客数, sum(behavior_type='pv')/count(distinct user_id) as 人均浏览量, sum(behavior_type='b
-- 3.1.2 练习:周一至周日PV、UV、人均浏览量、成交量、成交额select 星期, sum(behavior_type='pv') as 浏览量, count(distinct user_id) as 访客数, sum(behavior_type='pv')/count(distinct user_id) as 人均浏览量, sum(behavior_type=
-- 2 数据预分析select count(distinct user_id) as 用户数, count(distinct item_id) as 商品数,count(distinct item_category) as 类目数from UserBehavior_new;select behavior_type,count(*) as 行为次数from UserBehavior_n
关注