FineBI实战项目一(7):每天每小时上架商品个数

1 明确数据分析目标

对所有商品的商家时间进行统计,统计每个小时上架商品的个数

2 创建用于保存数据分析结果的表

复制代码
create table app_hour_goods(
  id int primary key auto_increment,
  daystr varchar(20),
  hourstr varchar(20),
  cnt int
);

3 编写SQL语句进行数据分析

复制代码
select
	substring(createTime,1,10) as daystr,
	substring(createTime,12,2) as hourstr,
	count(*) as cnt
from ods_finebi_goods
group by
	substring(createTime,1,10),substring(createTime,12,2)
order by hourstr;

4 加载数据到结果表中

复制代码
insert into app_hour_goods
select
	null,
	substring(createTime,1,10) as daystr,
	substring(createTime,12,2) as hourstr,
	count(*) as cnt
from ods_finebi_goods
group by
	substring(createTime,1,10),substring(createTime,12,2)
order by hourstr;
相关推荐
m0_74079636几秒前
MongoDB节点一直处于RECOVERING状态怎么排查_Oplog陈旧与全量同步失败
jvm·数据库·python
2301_815901972 分钟前
Go语言怎么做秒杀系统_Go语言秒杀系统实战教程【实用】
jvm·数据库·python
2303_821287383 分钟前
C#怎么实现WebAPI版本控制_C#如何管理不同接口版本【核心】
jvm·数据库·python
woxihuan1234563 分钟前
如何使用MongoDB按前缀模糊查询_正则表达式^与索引利用
jvm·数据库·python
2401_824697663 分钟前
Golang怎么用Go实现数据导入导出平台_Golang如何支持CSV和Excel格式的批量数据导入导出【实战】
jvm·数据库·python
重生之小比特5 分钟前
【MySQL 数据库】内外连接
数据库·mysql
得一录8 分钟前
TradingAgents金融股票分析的最小实现
开发语言·数据库·人工智能·python
刘~浪地球11 分钟前
MongoDB安全与权限:企业级数据保护
数据库·安全·mongodb
阿正呀11 分钟前
C#怎么清空Dictionary字典_C#如何管理内存集合【基础】
jvm·数据库·python