Open psql
and connect to your database.
Use the \copy
command to export data from a remote or local database to a local CSV file.
\copy (select id, name from products) to 'my-local-file.csv' csv header
Use the \copy
command to import records from a local CSV file to a remote or local database.
\copy products from 'my-local-file.csv' csv header