How to Select N-th Highest Value From a Table (Doc ID 272682.1)

Last updated on DECEMBER 06, 2016

Applies to:

SQL*Plus - Version 8.1.7.0 and later
Oracle Database - Enterprise Edition - Version 8.1.7.0 and later
Information in this document applies to any platform.
Information in this document applies to any platform.

Goal

This document provides the SQL statement which can be used to find the N-th highest or lowest value from a table column of NUMBER datatype. Also, provides the N-th highest or lowest DISTINCT value of a table column.

For example :

- select the 5th highest salary record from the EMP table.
- select the 5th highest salary DISTINCT value from the EMP table.
- select the 5th lowest salary record from the EMP table.
- select the 5th lowest salary DISTINCT value from the EMP table.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms