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;
相关推荐
Harbor Lau1 小时前
IDEA连接达梦数据库
数据库
我该如何取个名字4 小时前
Mac mini 安装mysql数据库以及出现的一些问题的解决方案
数据库·mysql·macos
曹弘毅5 小时前
doris/clickhouse常用sql
数据库·sql·clickhouse·doris
菜萝卜子5 小时前
【Redis】redis主从哨兵
数据库·redis·缓存
蒂法就是我5 小时前
MySQL 的锁,表级锁是哪一层的锁?行锁是哪一层的锁?
数据库·mysql
IvanCodes6 小时前
MySQL 锁机制
数据库·sql·mysql·oracle
青春不流名6 小时前
docker-compose之graylog
数据库·mongodb
橘猫云计算机设计6 小时前
springboot-基于Web企业短信息发送系统(源码+lw+部署文档+讲解),源码可白嫖!
java·前端·数据库·spring boot·后端·小程序·毕业设计
林枫依依6 小时前
Unity 将Excel表格中的数据导入到Mysql数据表中
数据库·mysql·excel
时光追逐者6 小时前
MongoDB从入门到实战之MongoDB简介
数据库·mongodb