anthonydb/practical-sql

Ch. 4 ERROR: missing data for column "state_us_abbreviation"

chouci opened this issue · 3 comments

Listing 4.3 query:

COPY us_counties_2010
FROM '/Users/Hipolito/Downloads/us_counties_2010.csv'
WITH (FORMAT CSV, HEADER);

error:

ERROR: missing data for column "state_us_abbreviation"
CONTEXT: COPY us_counties_2010, line 2: ""
SQL state: 22P04

Mac OS, installed PostgreSQL exactly as suggested in the book, ran the query using pgAdmin4.

Looks like you solved this? Just making sure. If so, what was the issue?

Original problem:
Originally, I downloaded from https://github.com/anthonydb/practical-sql/tree/master/Chapter_04 the file us_counties_2010.csv, but, in my haste, instead of saving the contents as csv, I saved the link as .txt (so I downloaded the web page as text, instead of the .csv file). That's why the error message indicated missed data.

Solution:
Clone data directly to my machine using GitHub.

Great -- glad you got it sorted. I recommend also occasionally doing a git pull from the repo to get any updates to the code and documentation on your local.