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

How do I connect to a postgresql database?

505


How to setup postgresql sysv startup script?

530


What is the advantage of postgresql?

475


How do I connect to pgadmin server?

505


What is special about postgresql?

489






What is medical indexing?

499


What is a foreign key constraint why are such constraints important?

502


How to get the ddl of a table in postgresql?

525


What is gis data?

486


How do I create a foreign key in postgresql?

481


What is shared buffer in postgres?

465


Is postgresql like oracle?

528


Does postgres support json?

535


How to call postgresql function in asp net?

541


What is dual table in postgresql?

489