How to import data from .CSV in PostGres table in a simple way?
Importing data from a CSV file into a Postgres table
In this post I will explain how to import .CSV file bulk data into Postgres table. Here we use COPY command to copy data between a file and a table in PostgreSQL.
In a Query: I create a table named Sample_Test using below Query.
And I have a .CSV data file with all column names available in our table.
Copy data from .CSV to postgres table
Now execute the below query to copy data from .CSV file to the table Sample_Test.
To verify execute the select query.
Select * from Sample_Test
Output:
Note:
- All the columns should be in sequence
How to import data from .CSV in PostGres table in a simple way?
Reviewed by Ravi Kumar
on
2:23 PM
Rating:

what do you do if the csv file doesn't live on the db server?
ReplyDelete