Skip to content

Instantly share code, notes, and snippets.

@vithalsamp
Created February 25, 2018 10:49
Show Gist options
  • Select an option

  • Save vithalsamp/6475755f4ae893be7b0383cec7315e6d to your computer and use it in GitHub Desktop.

Select an option

Save vithalsamp/6475755f4ae893be7b0383cec7315e6d to your computer and use it in GitHub Desktop.
select
max(new_col) as max_col
from
(
--this part of the query is a derived table
select col+1 as new_col from table
) as tab1 -- derived table have an alias name.
hive> select max(new_col) as max_col from (select id+1 as new_col from dept) tab1 ;
Query ID = admin_20180119131810_4e7e71e6-4ac7-4d47-8ef0-3ca58e90999e
Total jobs = 1
Launching Job 1 out of 1
…
OK
301
Time taken: 8.17 seconds, Fetched: 1 row(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment