SQL MIN Function
Syntax
The MIN function in SQL is used to find the minimum value of a column.
-- Find the minimum value in a columnSELECT MIN(column1)FROM table_name;
-- Find the minimum value for each groupSELECT column2, MIN(column1)FROM table_nameGROUP BY column2;Example
-- Find the minimum salary of all employeesSELECT MIN(salary)FROM employees;/* Output:| MIN(salary) ||-------------|| 40000 |*/
-- Find the minimum salary for each departmentSELECT department, MIN(salary)FROM employeesGROUP BY department;/* Output:| department | MIN(salary) ||-------------|-------------|| Sales | 50000 || Marketing | 40000 || HR | 60000 |*/