HIVE SQL Queries

1 comment

Requirement : Select the 3rd highest product Price.

Query:

select max(product_price) from products p1
where product_price < (select max(product_price) from products p1
where product_price < ( select max(product_price) from products p2))

Output: 1099.00

 

Requirement : Select the Top 5 highest product Price.

Query:

select  distinct(product_price) from products p2
order by product_price desc limit 5

 

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “HIVE SQL Queries”