0

I have a set of data

alex, 50
anu, 85
limi, 41
sam, 56

I need to find the rank of the students and store it in another column with the rank eg:-

alex    50 3
anu     85 1
limi    41 4
sam     56 2

I tried with the rank function.

SELECT
  a.name, a.mark,
rank() over (ORDER BY a.mark DESC) as rank
FROM
  list a;

please help me. thanks in advance!!

user2728024
  • 1,496
  • 8
  • 23
  • 39

1 Answers1

1

this is not working

First thing you need to do when you ask for help is to learn how to ask for help. "It does not work", "it errors" are not proper ways of asking. You need to specify always what error you get or how exactly it does not work. Does it crash? Does it print 'Hello, World!'? Does it make the speakers beep? We're not clairvoyant.

Now, about Window and Analytic functions in HIVE. They were introduced in HIVE 0.11, see HIVE-896. You can read the specification in the Hive Language Manual, including examples.

Make sure you run on Hive 0.11 to start with.

Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569