w3resource

Basic SELECT statement: Get the maximum and minimum salary of all employees

MySQL Basic Select Statement: Exercise-7 with Solution

Write a query to get the maximum and minimum salary from employees table.

Sample table: employees


Code:

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

Pictorial Presentation of the above query


Result :


MySQL Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query to get the total salaries payable to employees.
Next: Write a query to get the average salary and number of employees in the employees table.

What is the difficulty level of this exercise?