Saturday, 15 August 2015

mysql - Proper field type for numbers to ORDER BY? -



mysql - Proper field type for numbers to ORDER BY? -

what's proper field type numbers in mysql?

i have field numbers 0.00, 4.12, 99.10, 130.99

so tinyint or smallint not valid since remove decimal places 0, 4, 131 etc.

when cose varchar cannot order because sorts 99.10 after 130.99

which type need? highest number not larger 1000.

decimal

column syntax:

`name` decimal(<precision>,<scale>)

note <precision> total column length, decimal(5,2) 3 digits before decimal , 2 after.

mysql sql-order-by decimal-point

No comments:

Post a Comment