L
L
LucasP2018-02-25 12:23:05
MySQL
LucasP, 2018-02-25 12:23:05

Price storage (mysql)?

Tell me the correct choice of data type for the field with the price, I tend to double (15,2). Will there be any problems with the conversion?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey, 2018-02-25
@VladimirAndreev

Integer is the most reliable option. Plus the currency code in a separate field.

M
Mikhail Bobkov, 2018-02-25
@mike_bma

decimal with the required precision.
example decimal(19,2) - store accurate to kopecks
or take more precision - if necessary

K
Konstantin Tsvetkov, 2018-02-25
@tsklab

MS SQL has the MONEY type, which is equivalent to NUMERIC(19,4).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question