Back to list Standard SQL How to Find the Minimum Value of a Column in SQL Database: SQL PostgreSQL MS SQL Server Oracle MySQL SQLite Operators:MIN Problem: You’d like to find the smallest numeric value in a column. Example: Our database has a table named employment with data in the following columns: id, first_name, last_name, department, and salary. idfirst_namelast_namedepartmentsalary 1EllieMartinesmarketing1200 2MartinJohnsonfinance2300 3MichaelJacobsproduction1100 4StephenKowalskimarketing4300 5StanleyMillermarketing3500 6JenyBrownfinance5000 7MargaretGreenmarketing1500 8LisaThomasproduction2800 Let’s find the lowest salary among all employees. Solution: SELECT MIN(salary) as min_salary FROM employment; Here’s the result: min_salary 1100 Discussion: To find the minimum value of a column, use the MIN() aggregate function; it takes as its argument the name of the column for which you want to find the minimum value. If you have not specified any other columns in the SELECT clause, the minimum will be calculated for all records in the table. In our example, the query returns the minimum salary among all employees. Of course, since it’s an aggregate function, MIN() can also be used with groups. For example, if we’d like to find the minimum salary for each department, we can write this query: SELECT department, MIN(salary) as min_salary FROM employment GROUP BY department; This query returns the minimum salary for each department: departmentmin_salary marketing1200 finance2300 production1100 Recommended courses: SQL Basics SQL Basics in SQL Server SQL Practice Set Recommended articles: An Introduction to Using SQL Aggregate Functions with JOINs A Beginner’s Guide to SQL Aggregate Functions See also: How to Count Distinct Values in SQL How to Order by Count in SQL? How to Sum Values of a Column in SQL? How to Find Maximum Values in Rows How to Find the Minimum Value of a Column in SQL How to Round Numbers in SQL How to Floor Numbers in SQL Tags: SQL PostgreSQL MS SQL Server Oracle MySQL SQLite Subscribe to our newsletter Join our weekly newsletter to be notified about the latest posts.