Affine Analytics Interview Questions | How to get 3 Min salaries?

Question

3 Minimum salaries

in progress 0
TheDataMonk 55 years 3 Answers 1194 views Grand Master 0

Answers ( 3 )

  1. select distinct(salary) from salary_details order by salary asc limit 3

  2. SELECT DISTINCT salary
    FROM employees a
    WHERE 3 >= (SELECT COUNT(DISTINCT salary)
    FROM employees b
    WHERE b.salary <= a.salary)
    ORDER BY a.salary DESC;

  3. select DISTINCT (salary)
    from Table
    ORDER BY salary ASC
    LIMIT 3;

Leave an answer

Browse
Browse