SQL MIN() Function
The SQL MIN() is a function, and return the lowest or minimum value of a numeric table column from query result.
The SQL MIN() function is supports only numeric column.
It can be used in SQL SELECT statement as well in SQL WHERE clause.
Related Links
You can also search these topics using sql server min date, sql minimum value.
SQL MIN() Syntax
The below syntax is used to select specific column from the specific table.
SELECT MIN(column_name1) FROM table_name;
Sample Database Table - Employee
ID | EmpName | Designation | Dept | JoinYear | Salary |
---|---|---|---|---|---|
1 | Vidyavathi | Mobile Database | PHP | 2012 | 8090.8 |
2 | Hanumanthan | Database Query Engine | Oracle | 2015 | 3470.7 |
3 | Geetha | SQL Database | SQL Server | 2013 | 3890.3 |
4 | Keshavan | Computer Science | PHP | 2012 | 2840 |
5 | Azaghu Varshith | Cloud Database | Java | 2012 | 11030.6 |
SQL MIN() Example
The following SQL SELECT statement find the lowest or minimum value of "Salary" column from the "Employee" table:
SELECT
MIN(Salary) As 'Minimum Salary'
FROM Employee;
The result of above query is:
Minimum Salary |
---|
2840 |
SQL MIN() Example - Using Group By Clause
The following SQL SELECT statement find the lowest or minimum salary in all "Dept" column from the "Employee" table:
SELECT
Dept, MIN(Salary) As 'Minimum Salary'
FROM Employee
GROUP BY Dept;
The result of above query is:
Dept | Minimum Salary |
---|---|
Java | 11030.6 |
Oracle | 3470.7 |
PHP | 2840 |
SQL Server | 3890.3 |
Related Links
You can also search these topics using aggregate functions in sql, sql aggregate functions, sql aggregate functions examples, sql find lowest value, sql aggregate queries, sql aggregate functions with examples, sql aggregate functions list.