由于我是Hive的新手,所以我总是遇到很多问题, 我想加入两个表,并根据“国家/地区”列创建一个分区表。
select * from mergetable limit 5;
好
148.113.13.214美国
4.175.198.160美国
24.146.153.181美国
203.156.137.68泰国
114.127.210.217印度尼西亚
show create table mergetable;
好
`CREATE TABLE `mergetable`(
`ipaddrss` string,
`country` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS INPUTFORMAT;`
CREATE TABLE `mergetable1`(
`website` string,
`dt` string,
`tm` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS INPUTFORMAT
答案 0 :(得分:0)
SELECT *
FROM (
select_statement
UNION ALL
select_statement
) unionResult
在此处查看两个表串联的详细语法和其他用例:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Union