bigdata/chapter2/init.sql

90 lines
3.2 KiB
MySQL
Raw Normal View History

2019-01-17 20:15:22 +08:00
-- 初始化脚本
create table crawl_infos (
`id` int(11) NOT NULL AUTO_INCREMENT,
total_count int comment '采集总量',
today_total_count int comment '当天采集量',
product_count int comment '产品采集条数',
today_product_count int comment '当天产品采集条数',
comment_count int comment '评论采集条数',
today_comment_count int comment '当天评论采集条数',
created_at datetime DEFAULT CURRENT_TIMESTAMP comment '统计时间',
PRIMARY KEY (`id`)
) COMMENT='采集信息表';
create table platform_infos (
`id` int(11) NOT NULL AUTO_INCREMENT,
free_cpu int comment '空闲cpu',
us_cpu int comment '用户cpu使用量',
sys_cpu int comment '系统cpu使用量',
total_memory int comment '总内存',
used_memory int comment '占用内存',
freed_memory int comment '空闲内存',
process_count int comment '进程数'
uptime varchar(255) comment '启动时间'
) comment='平台信息';
2019-01-18 10:16:23 +08:00
create table news (
2019-01-18 11:31:19 +08:00
`id` int(11) NOT NULL AUTO_INCREMENT,
2019-01-17 20:15:22 +08:00
2019-01-18 11:31:19 +08:00
comment_time varchar(255) comment '评论时间',
content varchar(1024) comment '评论内容',
comment_id varchar(255) comment '评论ID',
2019-01-18 10:16:23 +08:00
2019-01-18 11:31:19 +08:00
PRIMARY KEY (`id`)
2019-01-18 10:16:23 +08:00
)comment='最新抓取的20条信息';
2019-01-18 11:31:19 +08:00
create table last_day_counts (
`id` int(11) NOT NULL AUTO_INCREMENT,
last_day int default 0,
product_c int default 0,
comment_c int default 0,
PRIMARY KEY (`id`)
)comment ='最后5天历史采集量';
insert into last_day_counts(last_day, product_c, comment_c) values(1, 0, 0);
insert into last_day_counts(last_day, product_c, comment_c) values(2, 0, 0);
insert into last_day_counts(last_day, product_c, comment_c) values(3, 0, 0);
insert into last_day_counts(last_day, product_c, comment_c) values(4, 0, 0);
insert into last_day_counts(last_day, product_c, comment_c) values(5, 0, 0);
2019-01-18 15:16:16 +08:00
create table top10_sells (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_n` int default 0,
`product_name` varchar(1024) comment '商品名',
`comment_c` int default 0 comment '销量',
`good_c` int default 0 comment '好评',
`price` int default 0 comment '价格',
PRIMARY KEY (`id`)
) comment = '排名前10销量产品';
insert into top10_sells(order_n, product_name, comment_c, good_c) values(1, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(2, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(3, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(4, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(5, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(6, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(7, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(8, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(9, '', 0, 0);
insert into top10_sells(order_n, product_name, comment_c, good_c) values(10, '', 0, 0);
create table datas (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(255),
`data` json,
PRIMARY KEY (`id`)
) comment = '通用配置表';
insert into datas (`key`, data) values ('from_type', '{}');
2019-01-18 17:28:06 +08:00
insert into datas (`key`, data) values ('last_month_sell', '{}');