FineBI实战项目一(5):每日下订单用户总数分析

1 明确数据分析目标

统计每天下订单的总用户个数

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

use finebi_shop_bi;

create table app_order_user(
    id int primary key auto_increment,
    dt date,
    total_user_cnt int
);

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

select
	substring(createTime,1,10) as dt,
	count(distinct userId) as total_user_cnt
from
	ods_finebi_orders
where
	substring(createTime,1,10) = '2019-09-05'
group by
	substring(createTime,1,10);

4 加载数据到结果表中

insert into app_order_user
select
  null,
  substring(createTime,1,10) as dt,-- 2019-09-05这一天的日期
  count(distinct userId) as total_user_cnt
from
  ods_finebi_orders
where
  substring(createTime,1,10) = '2019-09-05'
group by
  substring(createTime,1,10);

最近更新

  1. TCP协议是安全的吗?

    2024-01-10 11:32:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-10 11:32:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-10 11:32:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-10 11:32:03       20 阅读

热门阅读

  1. 2024系统分析师---论软件系统架构风格

    2024-01-10 11:32:03       32 阅读
  2. 机器学习 -- 贝叶斯决策理论

    2024-01-10 11:32:03       39 阅读
  3. API的介绍

    2024-01-10 11:32:03       39 阅读
  4. git stash 命令详解

    2024-01-10 11:32:03       64 阅读
  5. redis(1)

    2024-01-10 11:32:03       38 阅读
  6. MATLAB中slist函数用法

    2024-01-10 11:32:03       33 阅读
  7. linux学习笔记

    2024-01-10 11:32:03       25 阅读
  8. 前端常用js、css效果

    2024-01-10 11:32:03       35 阅读
  9. C++经典程序(2)

    2024-01-10 11:32:03       34 阅读
  10. 《微信小程序开发从入门到实战》学习七十七

    2024-01-10 11:32:03       39 阅读