As stated by @rray b
is used for binary data, for example photos, zipped files, etc.
The types VARCHAR
and TEXT
are fields that use string
or accept from A to Z from 0 to 9, so use must be s
, do not use to do calculations. >
Then the supported characters vary depending on the collection used. For example:
-
utf8_general_ci
supports unicode characters however it is simpler.
-
utf8mb4_unicode_ci
supports most (if not all) unicode characters.
-
latin1_general_ci
does not use unicode, but supports accents.
That is, s
you can pass a string, but when the process arrives in the query the characters can be lost if they are not compatible with collection
used.
Working with Monetary Values
If you are going to use monetary values, maybe it is best to use DECIMAL
(note that you will not use comma ).
See this answers (although talking about sql-server): link
The decimal type
The decimal type does not have the same accuracy problems as float
and double
types. It is a kind of fixed point, not floating. In other words, if you define a field in a database as MySQL of type DECIMAL(10,2)
, it means that it will be a 10-digit number (in base 10), 2 of which will be after the comma. Ever. Some databases also internally store such data as strings.
This storage strategy eliminates the problem of data rounding, but on the other hand, it reduces the type's flexibility. While it may not be a good choice for data where the number of decimal places can not be set, it is a good choice for example for financial figures (since these always have 2 decimal places).
Note also that in some cases, decimal-type values will be converted to floating-point numbers implicitly when used in calculations. In this case if the expected result also of the decimal type, it will be rounded and converted from float to decimal. That is, accuracy is better, but it is not unlimited.
Source: link