Find Lowest Salary
We can use the keyword MIN to find the lowest value of a column from a table.
- MIN, which returns the maximum value of a column
Let's assume a table with the below table definition and data, where we need to find the lowest salary.
id name salary
===========================
1 Arun 20000
2 Kiran 15000
3 James 35000
4 Sammy 50000
5 Martin 25000
SQL Query Using MIN
SELECT MIN(salary) FROM employees;
This query returns the minimum value of the salary column from an employee table, which is the lowest salary.
SQL Query Using MIN and WHERE
SELECT MIN(salary) FROM employees WHERE id IN (1,3,5);
This query returns the lowest salary among the employees included based on the WHERE condition.
In this example, the WHERE condition includes the employees with id as 1, 3, and 5.
Overall
We now know the SQL Query to find the lowest value from a specific table column.