3.2.2 Mysql 表结构设计

联系人维度的表: tb_contacts

用于存放用户手机号码与联系人姓名

备注 类型
id 自增主键 int(11) NOT NULL
telephone 手机号码 varchar(255) NOT NULL
name 联系人姓名 varchar(255) NOT NULL

时间维度的表: tb_date

用于存放时间维度的相关数据

备注 类型
id 自增主键 int(11) NOT NULL
year 年,当前通话信息所在年 int(11) NOT NULL
month 月,当前通话信息所在月,如果按照年来统计信息,则month为-1。 int(11) NOT NULL
day 日,当前通话信息所在日,如果是按照月来统计信息,则day为-1。 int(11) NOT NULL

主表: tb_call

用于存放某个时间维度下通话次数与通话时长的总和。

id_date_contact 复合主键(联系人维度id,时间维度id) varchar(255) NOT NULL
id_date 时间维度id int(11) NOT NULL
id_contact 查询人的电话号码id int(11) NOT NULL
call_count_sum 通话次数总和 int(11) NOT NULL DEFAULT 0
call_duration_sum 通话时长总和 int(11) NOT NULL DEFAULT 0

Copyright © 尚硅谷大数据 2019 all right reserved,powered by Gitbook
该文件最后修订时间: 2018-11-26 14:43:46

results matching ""

    No results matching ""