Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which data type to use to store fractions? [closed]

I have some values like 3/5, 90/100 etc.

I have to store these values in separate columns in my database.

I am confused as to which datatype to use for this purpose; which is faster for insert and select operations?

like image 481
Muhammad Azhar Avatar asked May 11 '13 16:05

Muhammad Azhar


1 Answers

Two integers; Numerator and denominator. Insertion/storing will be pretty much the same speed for any data type which provides a reasonable representation of a fraction.

like image 137
Dog Avatar answered Sep 23 '22 01:09

Dog