Note that there are some explanatory texts on larger screens.

plurals
  1. POData Type for storing high precision decimals in MySQL
    primarykey
    data
    text
    <p>Similar to this <a href="https://stackoverflow.com/questions/12504208/what-mysql-data-type-should-be-used-for-latitude-longitude-with-8-decimal-places">question</a>, I have a CSV of currency rates which up to 9 decimal places accuracy.</p> <p>For example : <code>0.558659218</code> , <code>4470.011076</code> , <code>7.02E-05</code>, <code>0.000641138</code>, <code>20832.46989</code></p> <p>Which data type should I use for the column ?</p> <p>I tried <code>FLOAT</code> , <code>DOUBLE</code> and <code>DECIMAL(11,11)</code>, they produce one of the following warnings:</p> <ol> <li>Out of range value for column 'column_name' at row X</li> <li>Value truncated for column 'column_name' at row X</li> </ol> <p>when I use <code>SHOW WARNINGS</code> command.</p> <p>FYI, The SQL statement is as follow (but I guess it is not related):</p> <pre><code>LOAD DATA LOCAL INFILE 'currency.csv' INTO TABLE the_currency FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (currency_code, currency_buyin, currency_buyout); </code></pre> <p>Sample data of the CSV is as follow:</p> <pre><code>PHP,41.46218559,0.024118362 PKR,95.71731228,0.010447431 PLN,3.2056255,0.311951599 PYG,4470.011076,0.000223713 QAR,3.641148462,0.274638623 RON,3.524472347,0.283730415 RSD,87.59544136,0.011416119 RUB,31.41607934,0.031830834 RWF,626.1686594,0.001597014 SAR,3.750383024,0.266639432 SBD,7.130814403,0.140236436 SCR,13.08102784,0.076446592 SDG,4.412494807,0.226629162 SEK,6.683528257,0.149621571 SGD,1.221878378,0.81841206 SHP,0.623503208,1.603840987 SLL,4349.905174,0.00022989 SOS,1615.486542,0.000619009 SPL,0.166666667,6 SRD,3.274628066,0.305378193 STD,18949.99968,5.28E-05 SVC,8.75,0.114285714 </code></pre> <p>MySQL version: <code>5.5.34-0ubuntu0.12.04.1</code> and I'm working in console command.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload