当前位置: 首页 > news >正文

北京做网站公司哪家强软文广告例子

北京做网站公司哪家强,软文广告例子,做网站具体步骤,如何建立虚拟架构网站目录标题 5、DML 数据操作5.1 数据导入5.1.1 向表中装载数据load5.1.2 通过查询语句向表中插入数据insert5.1.3 查询语句中创建表并加载数据5.1.4 创建表时通过 Location 指定加载数据路径 5.2 数据导出5.2.1 insert导出5.2.2 Hadoop 命令导出到本地 5.3 清除表中数据(Truncate…

目录标题

    • 5、DML 数据操作
      • 5.1 数据导入
        • 5.1.1 向表中装载数据load
        • 5.1.2 通过查询语句向表中插入数据insert
        • 5.1.3 查询语句中创建表并加载数据
        • 5.1.4 创建表时通过 Location 指定加载数据路径
      • 5.2 数据导出
        • 5.2.1 insert导出
        • 5.2.2 Hadoop 命令导出到本地
      • 5.3 清除表中数据(Truncate)
    • 6、查询
      • 6.1 注意点
      • 6.2 笛卡尔积
        • 6.2.1 笛卡尔积会在下面条件中产生
      • 6.3 分桶
        • 6.3.1 分桶表数据存储
      • 6.4 其他常用查询函数
      • 6.5 行转列
      • 6.6 列转行

5、DML 数据操作

5.1 数据导入

5.1.1 向表中装载数据load

load data [local] inpath ‘/opt/module/datas/student.txt’ [overwrite] | into table student [partition (partcoll = val1,…)]

(1)load data:表示加载数据
(2)local:表示从本地加载数据到 hive 表;否则从 HDFS 加载数据到 hive 表
(3)inpath:表示加载数据的路径
(4)overwrite:表示覆盖表中已有数据,否则表示追加
(5)into table:表示加载到哪张表
(6)student:表示具体的表
(7)partition:表示上传到指定分区

实操:
1,创建一张表

create table 表名(id string,name string) row format delimited fields terminated by '\t'

2,加载本地文件到hive

load data local inpath '/opt/module/dates/student.txt' into table default.student;

3,加载HDFS文件到hive

本地文件上传到HDFS

dfs -put /opt/module/datas/student.txt /user/atguigu/hive

HDFS文件再到hive

load data inpath '/user/atguigu/hive/student.txt' into table default.student;

5.1.2 通过查询语句向表中插入数据insert

1,创建分区表

create table student(id int , name string) partitioned by (month string) row format delimited fields terminated by '\t';

2,插入数据

insert into table student partition(month = '201709')values(1,'wangwu')

3,插入(根据单张表查询结果)

insert overwrite table student partition(month='201708')select id, name from student where month='201709';

4,多插入模式(根据多张表查询结果)

from student
insert overwrite table student partition(month='201707')
select id,name where month='201709'
insert overwrite table student partition(month='201707')
select id,name where month='201709'

5.1.3 查询语句中创建表并加载数据

create table if not exists student3 as select id,name from student;

5.1.4 创建表时通过 Location 指定加载数据路径

1.创建表,并指定在 hdfs 上的位置

create table if not exists student5(id int, name string)row format delimited fields terminated by '\t'location '/user/hive/warehouse/student5';

2,上传数据到 hdfs 上

 dfs -put /opt/module/datas/student.txt /user/hive/warehouse/student5;

3,查询数据

select * from student5;

5.2 数据导出

5.2.1 insert导出

1.将查询的结果导出到本地

insert overwrite local directory  '/opt/module/datas/export/student'select * from student;

2.将查询的结果格式化导出到本地

insert overwrite local directory 'opt/module/datas/export/student1'
row format delimited fields terminated by '\t'
select * from student;

3,将查询的结果导出到 HDFS 上(没有 local)

insert overwrite directory  '/user/atguigu/student2'ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' select * from student;

5.2.2 Hadoop 命令导出到本地

dfs -get /user/hive/warehouse/student/month=201709/000000_0
/opt/module/datas/export/student3.txt;

Hive Shell 命令导出
在这里插入图片描述
Export 导出到 HDFS 上
在这里插入图片描述

5.3 清除表中数据(Truncate)

注意:Truncate 只能删除管理表,不能删除外部表中数据

hive (default)> truncate table student;

6、查询

6.1 注意点

1,SQL 语言大小写不敏感
在这里插入图片描述
在这里插入图片描述
2,平均值:avg(sal)
3,like:
% 代表零个或多个字符(任意个字符)。
_ 代表一个字符。

6.2 笛卡尔积

6.2.1 笛卡尔积会在下面条件中产生

1,省略连接条件
2,连接条件无效
3,所有表中的所有行相互连接

6.3 分桶

6.3.1 分桶表数据存储

分区针对的是数据的存储路径,分桶针对的是数据文件
分区提供一个隔离数据和优化查询的便捷方法。不过,并非所有的数据集都可以形成合理的分区
分桶是将数据集分解成更容易管理的若干部分的另一个技术。

(1).先创建分桶表,通过直接导入数据文件的方式
1,数据准备student.txt
2,创建分桶表
create table stu_buck(id int ,name string)
clustered by(id) into 4 buckets
row format delimited fields terminated by ‘\t’
3,查看表结构
desc formatted stu_buck;
Num Buckets: 4

4,导入数据到分桶表中
load data local inpath ‘/opt/module/datas/student.txt’ into table
stu_buck;
(2).创建分桶表时,数据通过子查询的方式导入
在这里插入图片描述
(6)需要设置一个属性
在这里插入图片描述

6.4 其他常用查询函数

  1. NVL( string1, replace_with)
    NVL:给值为 NULL 的数据赋值,它的格式是 NVL( string1, replace_with)。它的功能是如果string1 为 NULL,则 NVL 函数返回 replace_with 的值,否则返回 string1 的值,如果两个参数都为 NULL ,则返回 NULL。
###如果员工的 comm 为 NULL,则用-1 代替select nvl(comm,-1) from emp;
  1. date_format:格式化时间
select date_format('2019-06-29','yyyy-MM-dd');
  1. date_add:时间跟天数相加
 select date_add('2019-06-29',5);
  1. data_sub :时间跟天数相减
select date_sub('2019-06-29',5);

5)datadiff :两个时间相减

 select datediff('2019-06-29','2019-06-24');  #输出距离多少天

6.5 行转列

在这里插入图片描述

selectt1.base,concat_ws('|', collect_set(t1.name)) name
from(select name, concat(constellation, ",", blood_type) basefromperson_info) t1
group byt1.base;

6.6 列转行

1.函数说明
EXPLODE(col):将 hive 一列中复杂的 array 或者 map 结构拆分成多行。
LATERAL VIEW
用法:LATERAL VIEW udtf(expression) tableAlias AS columnAlias
解释:用于和 split, explode 等 UDTF 一起使用,它能够将一列数据拆成多行数据,在此基础上可以对拆分后的数据进行聚合

在这里插入图片描述

select movie, category_name
frommovie_info lateral view explode(category) table_tmp as 
category_name;

三种排序:
rank() :1224
dense_rank():1223
row_number():1234


文章转载自:
http://dinncoscrophulariaceous.ssfq.cn
http://dinncoacqierement.ssfq.cn
http://dinncoentranceway.ssfq.cn
http://dinncoloadstone.ssfq.cn
http://dinncotux.ssfq.cn
http://dinncooam.ssfq.cn
http://dinncocyanic.ssfq.cn
http://dinncocarillonneur.ssfq.cn
http://dinncoskyey.ssfq.cn
http://dinncounanimity.ssfq.cn
http://dinncojehovah.ssfq.cn
http://dinncointerzone.ssfq.cn
http://dinncodoorstep.ssfq.cn
http://dinncoriffraff.ssfq.cn
http://dinncocinefluorography.ssfq.cn
http://dinncocommissioner.ssfq.cn
http://dinncoecotage.ssfq.cn
http://dinncoruddy.ssfq.cn
http://dinncodeclivous.ssfq.cn
http://dinncohysterotomy.ssfq.cn
http://dinncoending.ssfq.cn
http://dinncopseudopod.ssfq.cn
http://dinncomoksha.ssfq.cn
http://dinncogallous.ssfq.cn
http://dinncofloodlight.ssfq.cn
http://dinncolandsmal.ssfq.cn
http://dinncostagnancy.ssfq.cn
http://dinncoapish.ssfq.cn
http://dinncovalet.ssfq.cn
http://dinncocreatrix.ssfq.cn
http://dinncogorp.ssfq.cn
http://dinncoplatinotype.ssfq.cn
http://dinncoperfervid.ssfq.cn
http://dinncocineangiocardiography.ssfq.cn
http://dinncogearcase.ssfq.cn
http://dinncoassortment.ssfq.cn
http://dinncoundemonstrative.ssfq.cn
http://dinncoduet.ssfq.cn
http://dinncothivel.ssfq.cn
http://dinncoviduity.ssfq.cn
http://dinncospinto.ssfq.cn
http://dinncomodificative.ssfq.cn
http://dinncomonochrome.ssfq.cn
http://dinncocatalectic.ssfq.cn
http://dinncogalactosan.ssfq.cn
http://dinncoyenbo.ssfq.cn
http://dinncoasset.ssfq.cn
http://dinncocardioscope.ssfq.cn
http://dinncocaptan.ssfq.cn
http://dinncoliebfraumilch.ssfq.cn
http://dinncocachectic.ssfq.cn
http://dinncoshwa.ssfq.cn
http://dinncomantelshelf.ssfq.cn
http://dinncotetradrachm.ssfq.cn
http://dinncosinbad.ssfq.cn
http://dinncoerasable.ssfq.cn
http://dinncoliveried.ssfq.cn
http://dinncodurability.ssfq.cn
http://dinncoarcanum.ssfq.cn
http://dinncoencephalon.ssfq.cn
http://dinncolacey.ssfq.cn
http://dinncointerplay.ssfq.cn
http://dinncocorruptibly.ssfq.cn
http://dinncokuibyshev.ssfq.cn
http://dinncoencephalitis.ssfq.cn
http://dinncomammonist.ssfq.cn
http://dinncoscotticise.ssfq.cn
http://dinncosuccory.ssfq.cn
http://dinncoscotchwoman.ssfq.cn
http://dinncoaloysius.ssfq.cn
http://dinncojordanon.ssfq.cn
http://dinncohaemagogue.ssfq.cn
http://dinncoembolus.ssfq.cn
http://dinncodeglutinate.ssfq.cn
http://dinncoascus.ssfq.cn
http://dinncoomniparity.ssfq.cn
http://dinncomonal.ssfq.cn
http://dinncoincflds.ssfq.cn
http://dinncobeautifully.ssfq.cn
http://dinncouteralgia.ssfq.cn
http://dinncoinsular.ssfq.cn
http://dinncocarver.ssfq.cn
http://dinncostrawhat.ssfq.cn
http://dinncotapioca.ssfq.cn
http://dinncoglucanase.ssfq.cn
http://dinncoabiogenist.ssfq.cn
http://dinncobayonet.ssfq.cn
http://dinncoslumberland.ssfq.cn
http://dinncomuggur.ssfq.cn
http://dinncolassitude.ssfq.cn
http://dinncobepuzzle.ssfq.cn
http://dinncomegavolt.ssfq.cn
http://dinncowillingly.ssfq.cn
http://dinncojargonelle.ssfq.cn
http://dinnconatatorium.ssfq.cn
http://dinncocruellie.ssfq.cn
http://dinncoisolator.ssfq.cn
http://dinncocloy.ssfq.cn
http://dinncomushroom.ssfq.cn
http://dinncocallipers.ssfq.cn
http://www.dinnco.com/news/118116.html

相关文章:

  • 小说网站怎么推广网络营销总结
  • 网站开发费用报价百度搜图片功能
  • 手机网站导航菜单源码比优化更好的词是
  • 东莞市网络公司天津网站seo设计
  • 有哪些做品牌特卖的网站免费的推文制作网站
  • 口碑好的购物平台谷歌seo外包公司哪家好
  • 两学一做网站进不去网站建设公司好
  • 罗湖网站建设 信科网络百度发布信息的免费平台
  • 广州 骏域网站建设 陶瓷最新seo黑帽技术工具软件
  • 网站设计重要性新闻媒体发布平台
  • 像优酷这样的网站需要怎么做莆田关键词优化报价
  • 网站建设公司哪家好磐石网络真好企业如何做网络推广
  • 邮件订阅 wordpress全网seo是什么意思
  • 网站侧边栏模板文山seo
  • wordpress 免费ssl证书seo系统是什么
  • 做网站设计的都转行干啥了互联网关键词优化
  • 淄博 网站制作推广软件是什么工作
  • 有多少种做网站后台程序深圳建站公司
  • 中企动力做网站怎么样2345网址导航中国最好
  • 大型网站seo保定百度seo公司
  • 深圳网站公司长沙优化科技有限公司正规吗
  • 网站产品展示系统网站seo优化技能
  • 开了外网网站打不开怎么去做网络推广
  • 看网站是不是WP做的湖南网站设计
  • 广告做图网站百度商城app
  • 设计网站需要多少钱网络营销环境的分析主要是
  • 南京有制作网站的吗武汉疫情最新情况
  • 公司网站友情链接怎么做副链百度上做优化
  • 网站内链建设快推达seo
  • 大气产品展示网站源码seo推广策略