If you need to populate a PostGreSQL table with data that comes in .csv (comma-separated values) file format, here are the steps to do so:
1. Login to PostGreSQL with your user that can access and manipulate the table
psql -h dba-works-01 -U dbaworks salesdb
2. Use the copy command to populate the table with data from .csv file
COPY transactions FROM '/path-to-csv-file/transactions.csv' WITH (FORMAT csv);
NOTE that you can use COPY when you have superuser root privileges.
OR you can use \COPY if you do not have superuser access.
\COPY transactions FROM '/path-to-csv-file/transactions.csv'
DELIMITER ',' CSV
If you want to learn about PostgreSQL or update your knowledge about it, you can check out this book below: