Beginner

65. MIN Function

Learn how to find the smallest value in a dataset using MIN.

📘 Lesson 65 of 728 ⏱ 6 min 🎯 Beginner

The MIN function returns the smallest value from a set of values. It can be used with numeric, date, and other comparable data types depending on the database system.

Finding minimum values helps analysts identify the lowest salary, smallest transaction, earliest date, lowest price, or minimum performance value.

An HR analyst wants to find the lowest salary recorded in the Employees table. MIN can return the smallest Salary value.

SQL
SELECT
    MIN(Salary) AS MinimumSalary
FROM Employees;

MIN is useful for salary analysis, transaction monitoring, price analysis, inventory analysis, date analysis, and performance reporting.

  • MIN returns the smallest value.
  • MIN is an aggregate function.
  • It can work with numeric values.
  • It can also work with dates.
  • NULL values are generally ignored.
What does MIN do in SQL?

MIN returns the smallest value from the selected values.

Can MIN be used with dates?

Yes. MIN can return the earliest date when used with an appropriate date column.

Have you finished this lesson?

Introduction to SQL – All Lessons