• Ivy Seo

Insert Data from csv file - Postgresql/psql

To insert data into table from csv file - Postgres:


* Make sure Type is correct, and it should be only data, not column name included *


- use this in PgAdmin sql query:

> COPY TableName FROM '/home/ivy/Downloads/csvFileName.csv' WITH (FORMAT csv);


- use this in psql: (to open psql terminal click this)

> \COPY TableName FROM '/home/ivy/Desktop/Downloads/csvFileName.csv' WITH (FORMAT csv)";

> just add '\'