Masthead

Adding Data

Editing Data

You can add and edit data directly in PostgreSQL. Just open the table by right clicking on it and select one of the "View..." options. Then, click in the field you want to edit. To add new records, just click in the bottom row and start adding data.

The table will have to have a primary key field to be edited.

Loading Data

Loading large quantities of data can be "copied" into PostgreSQL if it is in a spreadsheet. The idea is to create a spreadsheet whose columns exactly match a table you've created in a database.

Import

Try the following to see if it works in your version of PostgreSQL. If you have problems, see the "COPY" command below.

  1. Right click on a table and select "Import..."
  2. Specify the "Format" as "CSV".
  3. Select "UTF8" for the "Encoding"
  4. In the "Misc. Options" tab:
    1. Check the "Header" box
    2. Select "," as the "Delimiter"

COPY

Enter the following command into a PostgreSQL SQL window, replace the table name and the path to the file and execute it. PostgreSQL will load the contents of the file directly into the specified table.

COPY ref_species FROM 'C:/GISData/1_Original/FIA/Ref_species_subset.cs.csv' DELIMITER ',' CSV HEADER;

This command will not work if there is a serial primary key in the table. I recommend, creating the table without a primary key, executing "COPY", then, adding the primary key.

© Copyright 2018 HSU - All rights reserved.