熟悉 Hive 的基本操作

4、实验步骤

(一)创建一个内部表 stocks,字段分隔符为英文逗号,表结构下所示。

col_name data_type
exchange string
symbol string
ymd string
price_open float
price_high float
price_low float
price_close float
volume int
price_adj_close float

创建内部表stocks:

create table if not exists stocks
(
`exchange` string,
`symbol` string,
`ymd` string,
`price_open` float,
`price_high` float,
`price_low` float,
`price_close` float,
`volume` int,
`price_adj_close` float
)
row format delimited fields terminated by ',';

在这里插入图片描述

查看表:

describe stocks;

在这里插入图片描述

(二)创建一个外部分区表 dividends(分区字段为 exchange 和 symbol),字段分隔符为英 文逗号,表结构如表下所示。

col_name data_type
ymd string
dividend float
exchange string
symbol string

创建外部分区表 dividends:

create external table if not exists dividends
(
`ymd` string,
`dividend` 

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/3ba225c4a5.html