Skip to content

Instantly share code, notes, and snippets.

@spara
Created April 11, 2012 20:42
Show Gist options
  • Select an option

  • Save spara/2362415 to your computer and use it in GitHub Desktop.

Select an option

Save spara/2362415 to your computer and use it in GitHub Desktop.
creating database of 2000 and 2010 Census
# create the database
createdb census_sf1
# create 2010 SF1 tables
psql census_sf1 -f create_SF1_2000_tables.sql
# create the 2010 geo_header table
create_geo_header_2010_table.sql
# load sf1_00017 and sf1_00001 tables
psql -U postgres COPY sf1_00017 FROM '/path/to/xx000172010.sf1' CSV;
psql -U postgres COPY sf1_00001 FROM '/path/to/xx000172010.sf1' CSV;
# create 2010 SF1 tables
psql census_sf1 -f create_SF1_2000_tables.sql
# create the 2000 geo_header table
create_geo_header_2000_table.sql
# load sf1_00017 and sf1_00001 tables
psql -U postgres COPY sf10017 FROM '/path/to/tx00017.uf1' CSV;
psql -U postgres COPY sf10001 FROM '/path/to/tx00001.uf1' CSV;
# create tract relationship tables
psql -U postgres create_tract_relationship_tables.sql
psql -U create_changed_tracts_table.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment