Skip to content

Instantly share code, notes, and snippets.

View mmfouda's full-sized avatar

Mostafa M. Fouda mmfouda

View GitHub Profile
@mmfouda
mmfouda / postgres-import-export-csv.md
Created March 1, 2018 23:59 — forked from nepsilon/postgres-import-export-csv.md
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY command.

Import CSV into table t_words:

COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;

You can tell quote char with QUOTE and change delimiter with DELIMITER.