Importing to PostgreSQL
With pgAdmin
Download the
us-cities.zip
file using the unique download link we emailed to you after purchase. This link looks like:https://www.uscitieslist.org/download/xxxx-xxxx/
Once the download has finished double-click the
us-cities.zip
file and extract theus-cities/sql/us-cities.sql
script to your computer. Make a note of the location you extract theus-cities.sql
file to — you'll need it in step 5.Open pgAdmin.
Select
Tools > Query Tool
lfrom the navigation bar.From the Query Tool select
File > Open
from the navigation and open theus-cities.sql
file that you extracted in step 2.Select
Query > Execute
from the navigation to run the script. This will create a new table calledus_cities
and insert the data. This typically takes a few seconds to complete.
With the terminal (Mac & Linux)
Press
CTRL+ALT+T
to open a new terminal window.Download the
us-cities.zip
file using the unique download link we emailed to you after purchase. You can do this with thewget
command:$ wget -O us-cities.zip https://www.uscitieslist.org/download/xxxx-xxxx/
Once the download has finished decompress the
us-cities.zip
file. You can do this with theunzip
command:$ unzip us-cities.zip
Use the
psql
command with the-f
flag to create the table and import the data from the script. For example to import the data into theexample_db
database you should use the command below.$ psql -d example_db -f us-cities/sql/us-cities.sql