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
- All the columns should be in sequence