LARGE
LARGE is an aggregate function in SQL. It retrieves the nth largest value from a particular column or a dataset. It is quite helpful when you need to find a value based on its rank without ordering or sorting the data.
Example
Output
Explanation
The SQL query above first creates an ‘Employees’ table with ‘ID’ and ‘Salary’ as columns. It then inserts 5 records into the table. The MAX
function is finally used to find the largest salary, which in this case is 10000
.
Example
Output
Explanation
This SQL code retrieves the largest Size
value from the Products
table, using the MAX
function to find the maximum value within the Size
column.
Example
Output
Explanation
In this example, we use the Oracle SQL MAX()
function to find the highest number in the Salary
column of the Employees
table. The column alias LargestSalary
is used for the returned value. The largest value in the Salary
column is returned as the result.