This is going to be a short article which will illustrate importing and exporting a table from or to a csv file using PostgreSQL COPY command.
Importing a table from CSV
Assuming you already have a table in place with the right columns, the command is as follows
COPY FROM ‘/path/to/csv/SourceCSVFile.csv’ DELIMITERS ‘,’ CSV;
Exporting a CSV from a table.
COPY TO ‘/path/to/csv/TargetCSVFile’ DELIMITERS ‘,’ CSV;