How to find the maximum and minimum values of a column in MySQL?

To find the maximum and minimum values of a column, you can use the following query statement:

SELECT MAX(column_name) AS max_value, MIN(column_name) AS min_value FROM table_name;

In this query statement, replace column_name with the name of the column for which you want to find the maximum and minimum values, and replace table_name with the name of the table.

For instance, if you want to find the maximum and minimum values of a column named “salary” in the table “employees,” you can use the following query statement:

SELECT MAX(salary) AS max_salary, MIN(salary) AS min_salary FROM employees;
Leave a Reply 0

Your email address will not be published. Required fields are marked *