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

漫画做视频在线观看网站互站网

漫画做视频在线观看网站,互站网,便利的菏泽网站建设,网站建设视频教程原生数据类型 准备数据 查看表信息 加载数据 查看数据 复杂数据类型-数组 准备数据 查看数据 ​优化 复杂数据类型-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 array<string>
)
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 map<string,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;

指定数据:查看id=1的“大圣娶亲”和“至尊宝”的皮肤价格。

select*,skin_price['大圣娶亲'],skin_price['至尊宝']
from t_hot_hero_skin_price
where id=1
;

 

 复杂数据类型-默认分隔符

准备数据

-- 创建表
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.hotlads.com/news/1335.html

相关文章:

  • 台州外贸网站建设微博推广费用
  • 五里桥街道网站建设有哪些营销推广方式
  • html代码hr表示什么seo com
  • 网站二级目录怎么做301b站官方推广
  • 设计师找灵感的网站网站排名优化公司
  • 如何构建网站平台贵州seo推广
  • 网站建设完工确认书济南网站设计
  • 建筑企业网站要简约大气吗保定关键词排名推广
  • 双语网站模板下载专门看网站的浏览器
  • 温州网站优化指导深圳20网络推广
  • 摄影师作品网站有哪些电脑软件推广平台
  • 做网络作家哪个网站好如何做网络营销
  • 连云港网站制作公司哪家好线上营销渠道
  • fireworks个人网站模板网络技术推广服务
  • 中国b2b网站大全市场营销策划案的范文
  • 重庆施工员证书查询官方网站seo案例分享
  • 网页设计代码书seo需求
  • 网站的视频怎么下载使用软件提高百度推广排名
  • 万户网络做网站怎么样长沙谷歌优化
  • 做百度网站如何收费免费网站模板库
  • 做网站 设备网站开通
  • 日本韩国澳大利亚出线seo排名优化课程
  • wordpress新闻网站模板武汉网络优化知名乐云seo
  • 河南新乡做网站公司今天特大军事新闻
  • 做民宿哪个网站好facebook海外推广
  • 手机网站开发视频教程福建seo快速排名优化
  • 珠海网站推广优化semseo
  • 网站开发技术流程上海网站快速优化排名
  • 合肥网上商城网站建设seo公司彼亿营销
  • 非模板网站郑州整站网站优化