SQL Window Functions in Hive

One of the powerful capabilities of SQL 2003 is the ability to use window functions, e.g., this query computes the ratio of a score to the average score of lower scores, for each product

select score/(sum(score)/row_number()), product over (partition by product order by score) from product_scores

Leave a Reply

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