官网地址:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
方法一:
CREATE TABLE IF NOT EXISTS default.weblog(
ip string ,
time string ,
req_url string ,
status string ,
size string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' ;
方法二:
CREATE TABLE default.weblog_comm
AS select ip, time, req_url from default.weblog;
方法三:
CREATE TABLE IF NOT EXISTS default.weblog_20150923
LIKE default.weblog ;
查看表结构:
hive> desc default.weblog_comm;
加载数据:
hive> load data local inpath '/opt/hive-0.13.1/weblog.txt' into table default.weblog ;
查看表数据:
hive> select * from default.weblog;