I've imported a spreadsheet of U.S. Government statistics into a mysql table with the aim of working through a tutorial.
However, it would appear that the U.S. Government has changed its formatting so that some of numerical figures are wrapped in quote marks, turning them into strings.
For example, this is the format of the tab-separated data that I'm supposed to have downloaded:
CN010010 01 001 "Autauga County, AL" 2005 23831 23061 770 3.2
However, it looks like this: CN010010 01 001 "Autauga County, AL" 2005 "23,831 " "23,061 " 770 3.2
As a result the two key columns of data (the 23831 and 23061 bits) that I want to import as integers are registering as 0 - presumably because it doesn't meet the data type.
What's the best solution for resolving this problem, now and in the future?
Thanks in advance.
The "comma" might cause problem. Are you using load data infile for this?
Assuming table definition:
The following would import the file:
would insert the following row: