简体   繁体   中英

Select a lot of columns from two different tables using hive SQL

I have two tables A & B. They share some columns. I want to select the common part of these two tables.

I know the following code is ok:

select col1, col2, ..., colN from A
union all
select col1, col2, ..., colN from B

However, I think the code is not good enough because I write col1, col2, ..., colN twice. It will be painful if I want to update the selected columns.

Does anybody have any other suggestion?

select * from A
union all CORRESPONDING BY (col1, col2, ..., colN)
select * from B

ANSI/ISO SQL-2016, Feature F301, CORRESPONDING in query expressions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM