23数据转化:将修改后的表用记事本打开,另存为文本文档类型, 格式为UTF8;处理后如下: g,10.:3:4被m,371579632本地,0.1,6 3851605 13838516056,本地,0,1,1036 3503818025,本地,0.29,1,18 5,20:43:15,被 16,21:44:28,主叫,18614980732,本地,0.29,1,23 345 26,14:19:15,主叫,37156680372 27.8:30:37.被叫,37160980271.本地,0.1.47 24新建mysq数据库grtx,添加 tonghua, duanxin, luliang表,sql 语句如下: create database grtx create table tonghua th xuhao int auto increment primary key th qishi time not null th fangshi char(4)not null th duifang char(11)not null th leixing char(4)not null th feiyang float, th yuefen in th shichang int not null create table duanxi dx xuhao int auto increment primary key, dx qishi time not null, dx duifang char(15) not null
5 2.3 数据转化:将修改后的表用记事本打开,另存为文本文档类型, 格式为 UTF-8;处理后如下: 2.4 新建 mysql 数据库 grtx,添加 tonghua,duanxin,liuliang 表,sql 语句如下: create database grtx; use grtx; create table tonghua ( th_xuhao int auto_increment primary key, th_qishi time not null, th_fangshi char(4) not null, th_duifang char(11) not null, th_leixing char(4)not null, th_feiyong float, th_yuefen int not null, th_shichang int not null ); create table duanxin ( dx_xuhao int auto_increment primary key, dx_qishi time not null, dx_duifang char(15) not null
dx yuefen int not null create table liuliang 11 xuhao int increment primary key, 11 feiyang float ll rigi date not null ll liuliang int not null, II yuefen int not null 2.5使用 Navicat导入数据: 1)右击表名,选择导入数据 2)选择txt文本格式 3)更改栏位分隔符为“,”,文本限定符为“无 你可以为源定义一些附加的选项,(4/8) 一个数编行 时间分符 小数卓符号 日期时闻排序日期时间 上步下-步→取 4)定义源附加选项
6 dx_feiyong float, dx_riqi date not null, dx_yuefen int not null ); create table liuliang ( ll_xuhao int auto_increment primary key, ll_qishi time not null, ll_feiyong float, ll_riqi date not null, ll_liuliang int not null, ll_yuefen int not null ); 2.5 使用 Navicat 导入数据: 1)右击表名,选择导入数据; 2)选择 txt 文本格式; 3)更改栏位分隔符为“,”,文本限定符为“无”; 4)定义源附加选项:
你可以定义栏位对应。设置对应指定的源栏位和目的栏位之间的对应关系。(6/8) 20170601-20170606 目标表 栏位 luliang 5)定义栏位对应,[一 上步[下步→[取消 6)导入成功。 3.数据分析工作过程 31分析个人语音通信中每个月的主叫和被叫的总次数及平均次 数;SQL语句: select th fangshi as方式 th yuefen as月份 count(th xuhao)as总 E from tonghua group by th fangshi, th yuefen; select th fangshi as方式, count(th xuhao) ount(distinct(th yuefen)as平均通话次 a from tonghua group by th fangshi 果
7 5)定义栏位对应: 6)导入成功。 3.数据分析工作过程 3.1 分析个人语音通信中每个月的主叫和被叫的总次数及平均次 数;SQL 语句:select th_fangshi as 方式,th_yuefen as 月份,count(th_xuhao) as 总 数 from tonghua group by th_fangshi,th_yuefen; select th_fangshi as 方式,count(th_xuhao)/count(distinct(th_yuefen)) as 平均通话次 数 from tonghua group by th_fangshi; 结果: