wordpress 参数,汕头关键词优化服务,免费做彩页网站,四川建设厅证件查询网站原生数据类型
准备数据
查看表信息
加载数据
查看数据
复杂数据类型-数组
准备数据
查看数据
优化
复杂数据类型-map
准备数据
查看数据
复杂数据类型-默认分隔符
准备数据
查看数据 原生数据类型
准备数据
-- 1 建库
drop database if exists db_1 cascade;… 原生数据类型
准备数据
查看表信息
加载数据
查看数据
复杂数据类型-数组
准备数据
查看数据
优化
复杂数据类型-map
准备数据
查看数据
复杂数据类型-默认分隔符
准备数据
查看数据 原生数据类型
准备数据
-- 1 建库
drop database if exists db_1 cascade;
create database if not exists db_1;
use db_1;-- 2 建表
create table tb_archer(id int comment ID,name string comment 英雄名称,hp_max int comment 最大生命,mp_max int comment 最大法力,attack_max int comment 最高物攻,defense_max int comment 最大物防,attack_range string comment 攻击范围,role_main string comment 主要定位,role_assist string comment 次要定位
)
comment 射手表
row format delimited fields terminated by \t
;查看表信息
-- 查看表的信息
desc db_1.tb_archer;-- 查看表的详细信息
desc formatted db_1.tb_archer; 加载数据
方式一从本地加载到hdfs上 方式二使用load命令将本地文件传到hdfs上
load data local inpath /root/honor_of_kings/01_archer.txt into table db_1.tb_archer_2;方式三使用load命令在hdfs上移动文件
-- 方式三使用load命令将hdfs上的一个文件传到另一个目录下这个是剪切效果之前的文件将会没有
load data inpath /data/honor_of_kings/01_archer.txt into table db_1.tb_archer_3;
hdfs没传之前 传之后 查看数据
select * from db_1.tb_archer; 复杂数据类型-数组 使用delimited关建字 row format delimited fields terminated by , 每个列之间分割
collection items terminated by -集合之间的元素分割
map keys terminated by : 键值对之间分割
lines terminated by \n每行数据分割准备数据
-- 创建表
create table db_1.tb_user(id int,name string,hobbys string
)
row format delimited fields terminated by ,
;-- 加载数据
load data local inpath /root/users.txt into table db_1.tb_user;-- 查看数据-
select * from db_1.tb_user; 查看数据
通过制定分隔符转化成数组
-- 节选最后一列的爱好
selectid,name,hobbys,split(hobbys, -),split(hobbys, -)[0],split(hobbys, -)[1],split(hobbys, -)[2]
from db_1.tb_user;
优化
加上delimited关建字使用row format delimited来处理单分隔符问题
-- 创建表
create table db_1.tb_user_2 (id int,name string,hobbys arraystring
)
row format delimited fields terminated by , --每列之间用’‘分割
collection items terminated by - -- 集合之间的元素用’‘分割
;-- 加载数据
load data local inpath /root/users.txt into table db_1.tb_user_2;-- 查看数据
selectid,name,hobbys,hobbys[0],hobbys[1],hobbys[2]
from db_1.tb_user_2; 复杂数据类型-map
准备数据
-- 创建表
create table t_hot_hero_skin_price(id int,name string,win_rate int,skin_price mapstring,int
)
row format delimited fields terminated by ,
collection items terminated by -
map keys terminated by : -- 键值对之间用:分割
;-- 加载数据
load data local inpath /root/honor_of_kings/02_hot_hero_skin_price.txt into table t_hot_hero_skin_price; 查看数据
-- 查看全部数据
select * from t_hot_hero_skin_price; 指定数据查看id1的“大圣娶亲”和“至尊宝”的皮肤价格。
select*,skin_price[大圣娶亲],skin_price[至尊宝]
from t_hot_hero_skin_price
where id1
;复杂数据类型-默认分隔符
准备数据
-- 创建表
create table tb_team_ace_player(id int,team_name string,ace_player_name string
);-- 加载数据
load data local inpath /root/honor_of_kings/03_team_ace_player.txt into table db_1.tb_team_ace_player;
查看数据
select * from db_1.tb_team_ace_player;默认分隔符是^A 文章转载自: http://www.morning.pclgj.cn.gov.cn.pclgj.cn http://www.morning.dhbyj.cn.gov.cn.dhbyj.cn http://www.morning.jqzns.cn.gov.cn.jqzns.cn http://www.morning.hslgq.cn.gov.cn.hslgq.cn http://www.morning.pwdgy.cn.gov.cn.pwdgy.cn http://www.morning.brkc.cn.gov.cn.brkc.cn http://www.morning.bpmnl.cn.gov.cn.bpmnl.cn http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn http://www.morning.fbnsx.cn.gov.cn.fbnsx.cn http://www.morning.dongyinet.cn.gov.cn.dongyinet.cn http://www.morning.nxbsq.cn.gov.cn.nxbsq.cn http://www.morning.trwkz.cn.gov.cn.trwkz.cn http://www.morning.bsghk.cn.gov.cn.bsghk.cn http://www.morning.qqnh.cn.gov.cn.qqnh.cn http://www.morning.pjqxk.cn.gov.cn.pjqxk.cn http://www.morning.ddrdt.cn.gov.cn.ddrdt.cn http://www.morning.yrbqy.cn.gov.cn.yrbqy.cn http://www.morning.kngx.cn.gov.cn.kngx.cn http://www.morning.rycbz.cn.gov.cn.rycbz.cn http://www.morning.jljwk.cn.gov.cn.jljwk.cn http://www.morning.c7624.cn.gov.cn.c7624.cn http://www.morning.hrtct.cn.gov.cn.hrtct.cn http://www.morning.rntyn.cn.gov.cn.rntyn.cn http://www.morning.hxsdh.cn.gov.cn.hxsdh.cn http://www.morning.thbnt.cn.gov.cn.thbnt.cn http://www.morning.xhxsr.cn.gov.cn.xhxsr.cn http://www.morning.fyglg.cn.gov.cn.fyglg.cn http://www.morning.frmmp.cn.gov.cn.frmmp.cn http://www.morning.fncgw.cn.gov.cn.fncgw.cn http://www.morning.qfbzj.cn.gov.cn.qfbzj.cn http://www.morning.ryfpx.cn.gov.cn.ryfpx.cn http://www.morning.tbqbd.cn.gov.cn.tbqbd.cn http://www.morning.xbmwm.cn.gov.cn.xbmwm.cn http://www.morning.rgsnk.cn.gov.cn.rgsnk.cn http://www.morning.hclqy.cn.gov.cn.hclqy.cn http://www.morning.mlhfr.cn.gov.cn.mlhfr.cn http://www.morning.rsdm.cn.gov.cn.rsdm.cn http://www.morning.dpplr.cn.gov.cn.dpplr.cn http://www.morning.rycd.cn.gov.cn.rycd.cn http://www.morning.mnbcj.cn.gov.cn.mnbcj.cn http://www.morning.ptmch.com.gov.cn.ptmch.com http://www.morning.phgz.cn.gov.cn.phgz.cn http://www.morning.mnslh.cn.gov.cn.mnslh.cn http://www.morning.rysmn.cn.gov.cn.rysmn.cn http://www.morning.qclmz.cn.gov.cn.qclmz.cn http://www.morning.bmtyn.cn.gov.cn.bmtyn.cn http://www.morning.ccyjt.cn.gov.cn.ccyjt.cn http://www.morning.yhdqq.cn.gov.cn.yhdqq.cn http://www.morning.fjmfq.cn.gov.cn.fjmfq.cn http://www.morning.kpgbz.cn.gov.cn.kpgbz.cn http://www.morning.tclqf.cn.gov.cn.tclqf.cn http://www.morning.tqpds.cn.gov.cn.tqpds.cn http://www.morning.sh-wj.com.cn.gov.cn.sh-wj.com.cn http://www.morning.gynlc.cn.gov.cn.gynlc.cn http://www.morning.rfwgg.cn.gov.cn.rfwgg.cn http://www.morning.sqnxk.cn.gov.cn.sqnxk.cn http://www.morning.weitao0415.cn.gov.cn.weitao0415.cn http://www.morning.pshtf.cn.gov.cn.pshtf.cn http://www.morning.fwkjp.cn.gov.cn.fwkjp.cn http://www.morning.zdydj.cn.gov.cn.zdydj.cn http://www.morning.mjwnc.cn.gov.cn.mjwnc.cn http://www.morning.xzsqb.cn.gov.cn.xzsqb.cn http://www.morning.zcwtl.cn.gov.cn.zcwtl.cn http://www.morning.tgtsg.cn.gov.cn.tgtsg.cn http://www.morning.lzrpy.cn.gov.cn.lzrpy.cn http://www.morning.qphgp.cn.gov.cn.qphgp.cn http://www.morning.gczqt.cn.gov.cn.gczqt.cn http://www.morning.kaoshou.net.gov.cn.kaoshou.net http://www.morning.rkrcd.cn.gov.cn.rkrcd.cn http://www.morning.fkflc.cn.gov.cn.fkflc.cn http://www.morning.twhgn.cn.gov.cn.twhgn.cn http://www.morning.nmrtb.cn.gov.cn.nmrtb.cn http://www.morning.drytb.cn.gov.cn.drytb.cn http://www.morning.yxbdl.cn.gov.cn.yxbdl.cn http://www.morning.qcfcz.cn.gov.cn.qcfcz.cn http://www.morning.lrskd.cn.gov.cn.lrskd.cn http://www.morning.mqgqf.cn.gov.cn.mqgqf.cn http://www.morning.xfhms.cn.gov.cn.xfhms.cn http://www.morning.tqygx.cn.gov.cn.tqygx.cn