Importing to SQLite

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 sqlite3 command to open (or create a new) SQLite database. For example to open the example.db database in your current directort use the command:

    $ sqlite3 example.db

  5. Once connected to the SQLite database use the .read command to run the import script you extracted in step 3.

    sqlite> .read us-cities/sql/us-cities.sql

  6. After the import is complete you can query the data. For example type the following query and hit enter:

    sqlite> SELECT * FROM us_cities LIMIT 10;