Retrieve highest and lowest salary From An Employee Table In MySql
In article we will explain how to write a MySQL query to Retrieve highest and lowest salary from the employees table.
Read Also : MySQL Query To Find The Second Highest Salary
Retrieve highest and lowest salary From An employees Table
First let’s create a simple example of employees table. We will populate this table with id, name, salary and department of employees.
SELECT * FROM employees; |
The following MySQL statement finds the highest and lowest salary From An employees Table:
SELECT MAX(salary), MIN(salary) FROM employees; |
In above MySQl query we used-
The MySQL MAX function returns the maximum value in a set of values.
The MySQL MIN function returns the minimum value in a set of values.