Basically it's type error.
Min and Max act alphabetically on strings.
To test, change the query to this:
SELECT MIN(0 + users_licensed) FROM prt_license
or this:
SELECT MAX(0 + users_licensed) FROM prt_license
So you will be forcing a numerical interpretation. But this is just for testing , ideally you should work with the column of the correct type.
Another good test (just like learning) would be to put the columns with a padding of zeros on the left, and to see that by "coincidence" the strings behave as numbers in the ordering question:
010
050
100
120
etc.
To convert column
Backup before changes of this type. The query below converts the table column to the correct type, causing its original SELECT
to work numerically.
ALTER TABLE prt_license MODIFY users_licensed INTEGER;
After conversion, just do this:
SELECT MAX(users_licensed) FROM prt_license;