RSS Feed

SQL MIN()

SQL MIN()

Returns the minimum value in an expression.

Example 1 of SQL MIN()
Selecting Min salary from EMP table:

SELECT Min(salary) as "Minimum Salary"
FROM EMP;

Example 2 of SQL MIN()
Selecting Min salary for each department:

SELECT Dept, Min(salary) as "Minimum Salary"
FROM EMP
GROUP BY Dept;


SQL MIN() ignores any null values.

With character data columns, SQL MIN() finds the value that is lowest in the sort sequence.