SQL MIN()

Anonymous contributor's avatar
Anonymous contributor
Published May 4, 2021Updated Sep 3, 2021
Contribute to Docs

The MIN() aggregate function takes the name of a column as an argument and returns the smallest value in a column.

  • Learn to analyze data with SQL and prepare for technical interviews.
    • Includes 9 Courses
    • With Certificate
    • Beginner Friendly.
      17 hours
  • In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Beginner Friendly.
      5 hours

Syntax

SELECT MIN(column_name)
FROM table_name;

The opposite of MIN() is MAX().

Example

For instance, suppose there’s a transactions table with the following values:

date amount
2023-01-30 2.75
2023-01-31 6.00
2023-01-31 4.20

The given query will return the smallest value from the amount column:

SELECT MIN(amount)
FROM transactions;

The result would be:

MIN(amount)
2.75

All contributors

Contribute to Docs

Learn SQL on Codecademy

  • Learn to analyze data with SQL and prepare for technical interviews.
    • Includes 9 Courses
    • With Certificate
    • Beginner Friendly.
      17 hours
  • In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Beginner Friendly.
      5 hours