MAX() function
The MAX function returns the maximum value in a column. NULL values are not included in the calculation.
SQL MAX() Syntax
SELECT MAX(column_name) FROM table_name
Note: MIN and MAX can also be used with text columns to obtain the highest or lowest value in alphabetical order.
SQL MAX() Example
We have the following "Orders" table:
Now, we Want to find the maximum value of the "OrderPrice" column.
We use the following SQL statement:
SELECT MAX(OrderPrice) AS LargestOrderPrice FROM Orders
The result set is similar to this:
PHP Chinese website, there are a lot of free SQL tutorial, everyone is welcome to learn!
The above is the detailed content of What is the usage of sql max. For more information, please follow other related articles on the PHP Chinese website!