MIN and MAX in SQL

HOW TO USE MIN() AND MAX() FUNTION IN SQL?

MIN() AND MAX()

MIN() function returns the smallest value of the selected column

Syntax โ€“

SELECT  MIN(ColumnName)

FROM <TableName>

WHERE<condition> ;   

Example-

SELECT  MIN(Price)

FROM Products;

MAX() function returns the largest value of the selected column

Syntax โ€“

SELECT  MAX(ColumnName)

FROM <TableName>

WHERE<condition> ;

Example-

SELECT  MAX(Price)

FROM Products;

Note-

Northwind database is used for examples.


Posted

in

Tags:

Comments

Leave a Reply