Max

Aggregate Function

Description

Returns the maximum value in a set of values.

Click here to navigate to the PostgreSQL docs page for this syntax.

The function Max() is supported on Snowflake.

Grammar Syntax

MAX(expression)

Sample Source Patterns

PostgreSQL

CREATE OR REPLACE TABLE ranks (
	rank int NOT NULL
);

INSERT INTO ranks
VALUES (6), (5), (8);

SELECT
   MAX(rank)
FROM
   ranks;

Snowflake

CREATE OR REPLACE TABLE ranks (
	rank int NOT NULL
);

INSERT INTO ranks
VALUES (6), (5), (8);

SELECT
   MAX(rank)
FROM
   ranks;

Last updated