SQL Min function

Syntax of using SQL min function

The general syntax of using the Min function is:

Select min(column_name) from table_name

Where col_name = value

The Min function of SQL

  • The SQL min() returns the minimum or lowest value in the given column.
  • You can use min function in a simple select statement.
  • You can also use it with the group by clause.
Min function example

The Min function example

In our examples, we will use the tbl_emp_salary_paid table that stores employees salaries (for illustration purpose only). See it by clicking the link with each example.

Example of using Min in simple select statement

This example returns lowest salary paid to the employee in the tbl_emp_salary_paid table.

The SQL query:


See this example online with graphic

You can see, the above query returned the lowest value from the emp_sal_paid column.

The Min with Group by example

This query will return minimum salary paid to each employee, where we will use the group by clause to gather each employees data and then check the minimum salary for each.

The query with group by and Min function:


See this example online with graphic

As you can see in above graphic, two queries are shown. The other query uses the group by clause to show minimum salary paid to each employee.

Also see SQL MAX | SQL count | SQL Group by

Was this article helpful?

Related Articles

Leave A Comment?