An unsigned bigint is the maximum int size in mysql as far as I'm aware. So for good measure I'm using varchar(255) since some values in my db are larger than an unsigned bigint.
I'm looking to order them though as if they were an int though. Is this possible?
Example: 999,1000,1001
Ordering this by Int goes 999,1000,1001 or 1001,1000,999
Ordering this by varchar goes 1000,1001,999 or 999,1001,1000
Since sorting via varchar compares a string one at a time
I’m wondering if it’s possible to store it via varchar but sort like an int
DECIMAL
data type, specifying a precision up to 65 digits, and a scale from 0 to 30 digits after the decimal. Do you really need to support up to 255 digit integers? Or would 65 digits ofDECIMAL(65,0)
suffice?'0'
s.