How to import a CSV file into a PostgreSQL database table

H

How Can We Help?

How to import a CSV file into a PostgreSQL database table

  1. Type in the following command in postgres using the command line:
    copy products from ‘/home/user/products.csv’ using delimiters ‘,’

    • products = (Database Table)
    • ‘/home/user/products.csv‘ = (Location of the csv file)
    • You need to have insert privileges on the table you need to insert the data to

How to export data to csv file from postgres database?

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me