第一步:创建表
-- 创建表
create table if not exists continue_days(
uid int comment '员工id',
tdate string comment '打卡日期',
is_flag int comment '是否打卡')
comment '打卡表'
row format delimited fields terminated by ',';
第二步:加载示例数据
-- 加载数据到continue_days表中
load data local inpath '/mnt/hgfs/Zshare/continue_day.csv'
into table continue_days;
-- 主机和虚拟机共享文件夹的命令
sudo vmhgfs-fuse -o subtype=vmhgfs-fuse,allow_other /mnt/hgfs/
示例数据如下
1,2020/2/1,1
1,2020/2/2,0
1,2020/2/3,1
1,2020/2/4,1
1,2020/2/5,0
1,2020/2/6,1
1,2020/2/7,1
1,2020/2/8,1
2,2020/2/1,1
2,2020/2/2,0
2,2020/2/3,0
2,2020/2/4,1
2,2020/2/5,1
2,2020/2/6,1
2,2020/2/7,1
2,2020/2/8,1
3,2020/2/1,1
3,2020/2/2,0
3,2020/2/3,1
3,2020/2/4,1
3,2020/2/5,1
3,2020/2/6,1
3,2020/2/7,1
3,2020/2/8,1
第三步:统计连续天数