-2

What is the best field type for the price in MySQL and PostgreSQL due the date?

[any number].[always two digits, except when value is 0]

Gediminas Šukys
  • 7,101
  • 7
  • 46
  • 59

3 Answers3

2

You should use decimal for MySQL. PostgreSQL also supports that

Alexander
  • 3,129
  • 2
  • 19
  • 33
0

DECIMAL in both, and no, this is not an "opinion-based question". :)

https://dev.mysql.com/doc/refman/5.1/en/precision-math.html

http://www.postgresql.org/docs/9.3/static/datatype-numeric.html - see arbitrary precision types

Leonid Shevtsov
  • 14,024
  • 9
  • 51
  • 82
0

I would use something like NUMERIC(15,2) for MySQL and the built-in MONEY data type in PostgreSQL.

Kouber Saparev
  • 7,637
  • 2
  • 29
  • 26