177. Nth Highest Salary

Tutd Schema:

 employee := relation{id Integer, salary Integer}{
  tuple{id 1, salary 100},
  tuple{id 2, salary 200},
  tuple{id 3, salary 300}};

Thinking Process:

-- nth highest salary

:showdataframe employee{salary} orderby {salary descending} offset n-1 limit 1

-- Right now, we don't have function definition like "getNthHighestSalary n = employee{salary} orderby {salary descending} offset (n-1) limit 1"

 

留言

這個網誌中的熱門文章

LeetCode 184. Department Highest Salary