how to find nth lowest salary

Answer Posted / liju

nth lowest
nth lowest
*******************************************************
SELECT DISTINCT (A.sal) FROM EMP A WHERE (N-1) =

(SELECT COUNT (DISTINCT (b.sal)) FROM EMP B

WHERE b.sal<a.sal);

nth highest
*******************************************************
SELECT DISTINCT (A.sal) FROM EMP A WHERE (N-1) =

(SELECT COUNT (DISTINCT (b.sal)) FROM EMP B

WHERE b.sal>a.sal);

Is This Answer Correct ?    14 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is postgresql a sql server?

607


How do you remove a foreign key constraint?

568


What is schema in teaching?

567


How to create a new table from existing table in postgresql?

606


What is the function of create command?

576






How to connect postgresql database using pgadmin 4?

541


How do I start a pgadmin server?

597


How to get month wise data in postgresql?

555


Can you have a composite foreign key?

587


What is the password of postgres user?

624


Is postgresql similar to sql server?

600


Which version of postgresql should I use?

579


What is a postgresql schema?

548


What is join and how many types of joins?

595


How many indexes per table are allowed in postgresql?

566