Min Function In Sql in SQL
? MIN() Function in SQL
The MIN() function returns the minimum (smallest) value from a set of values in a column.
? Syntax:
SELECT MIN(column_name) FROM table_name;? Example:
SELECT MIN(salary) AS lowest_salaryFROM employees;Result:
| lowest_salary |
|---|
| 25000 |
? Notes:
Works with numeric, date, and text (alphabetically) values.
Commonly used with
GROUP BYto find minimum per group:
SELECT department, MIN(salary) AS min_salaryFROM employeesGROUP BY department;? Supported in:
? MySQL, SQL Server, PostgreSQL, Oracle, SQLite, and others.
Want me to compare MIN() and MAX() or show usage in subqueries?