SQL Server MAX() Function

Example

Find the price of the most expensive product in the "Products" table:

SELECT MAX(Price) AS LargestPrice FROM Products;
Try it Yourself »

Definition and Usage

The MAX() function returns the maximum value in a set of values.

Note: Also look at the MIN() function.

Syntax

MAX(expression)

Parameter Values

Parameter Description
expression Required. A numeric value (can be a field or a formula)

Technical Details

Works in: SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.