Numerify interview question

Writing a query to find the average and the first three ranks only should come In the output

Interview Answers

Anonymous

1 Dec 2016

select avg(salary) from (select name, salary,rank() over(order by salary desc) as rank from emp_tbl) where rank <= 3;

Anonymous

20 Jun 2018

Could you please provide some more questions from your interview?

Anonymous

28 Feb 2019

Select empid,avg(salary) from (sel empid, salary, row-number() over(order by salary desc) as rank from emp) A Where A. Rank <=3 Group by empid;