Importing to PostgreSQL

With pgAdmin

  1. 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/

  2. Once the download has finished double-click the us-cities.zip file and extract the us-cities/sql/us-cities.sql script to your computer. Make a note of the location you extract the us-cities.sql file to — you'll need it in step 5.

  3. Open pgAdmin.

  4. Select Tools > Query Tool lfrom the navigation bar.

  5. From the Query Tool select File > Open from the navigation and open the us-cities.sql file that you extracted in step 2.

  6. Select Query > Execute from the navigation to run the script. This will create a new table called us_cities and insert the data. This typically takes a few seconds to complete.

With the terminal (Mac & Linux)

  1. Press CTRL+ALT+T to open a new terminal window.

  2. Download the us-cities.zip file using the unique download link we emailed to you after purchase. You can do this with the wget command:

    $ wget -O us-cities.zip https://www.uscitieslist.org/download/xxxx-xxxx/

  3. Once the download has finished decompress the us-cities.zip file. You can do this with the unzip command:

    $ unzip us-cities.zip

  4. 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 the example_db database you should use the command below.

    $ psql -d example_db -f us-cities/sql/us-cities.sql