2022-12-30
閱讀量:
912
mysql 學(xué)習(xí)42--字段處理后建新表
-- 1.4 字段處理:根據(jù)times字段增加計(jì)算字段用戶行為日期、周和小時(shí),排除后續(xù)分析不需要的user_geohash字段,并將篩選后的結(jié)果保存到新表
select
user_id,
item_id,
item_category,
behavior_type,
date(times) as 日期,
hour(times) as 小時(shí),
date_format(times,'%w') as 星期,
amount
from (select distinct * from UserBehavior) as t;
-- 將查詢結(jié)果保存到新表
create table UserBehavior_new as
select
user_id,
item_id,
item_category,
behavior_type,
date(times) as 日期,
hour(times) as 小時(shí),
date_format(times,'%w') as 星期,
amount
from (select distinct * from UserBehavior) as t;
select * from UserBehavior_new limit 100;






評(píng)論(0)


暫無數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評(píng)論
1條評(píng)論
0條評(píng)論