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;
idnamesalarydepartment
1Tom4000Technology
2Sam6000Sales
3Bob3000Technology
4Alen8000Technology
5Jack12000Marketing
6Charlie8000Human Resources
7Harry6000Marketing
8Jacob4000Human Resources

The following MySQL statement finds the highest and lowest salary From An employees Table:

SELECT MAX(salary), MIN(salary)
FROM employees;
MAX(salary)MIN(salary)
120003000

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.

Leave A Reply

Your email address will not be published.