How to calculate the maximum value in a column in SQL?
SQL MIN() and MAX() Functions
The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column.
Use the MAX() aggregate function to determine a column’s maximum value; this function accepts the name of the column you wish to determine the maximum value for as a parameter. The maximum will be determined for each record in the table if you don’t include any more columns in the SELECT clause.
To find the max value of a column, use the MAX() aggregate function; it takes as its argument the name of the column for which you want to find the maximum value. If you have not specified any other columns in the SELECT clause, the maximum will be calculated for all records in the table.
You may accomplish this by combining CAST() and MAX(). Because the string contains both a string and an integer, for example, “STU201”, we must use CAST().
