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;
相关推荐
Bert.Cai13 小时前
MySQL TRIM()函数详解
数据库·mysql
2301_8009769313 小时前
数据库的基本操作后续
java·数据库·sql
SECS/GEM13 小时前
SECS/GEM如何实现越南现场自定义消息
java·服务器·数据库
weixin_4249993614 小时前
PHP源码在双硬盘系统如何优化_硬件存储分配建议【指南】
jvm·数据库·python
ECT-OS-JiuHuaShan14 小时前
渡劫代谢,好事多磨
数据库·人工智能·科技·学习·算法·生活
qq_1898070314 小时前
json ignore反序列化?_?JSON反序列化时忽略字段的json----标签使用方法.txt
jvm·数据库·python
zhangchaoxies14 小时前
让水平滚动条始终固定在页面底部,实现跨视口的横向滚动控制
jvm·数据库·python
justjinji14 小时前
如何用组合继承模式实现父类方法复用与子类属性独立
jvm·数据库·python
SelectDB14 小时前
Apache Doris 4.1:面向 AI & Search 的统一数据存储与检索底座
大数据·数据库·数据分析
djjdjdjdjjdj14 小时前
PHP函数如何监控CPU温度传感器_PHP读取核心温度硬件值【详解】
jvm·数据库·python