How to Export PostGres table to .CSV file in a simple way?

random

How to Export PostGres table to .CSV file in a simple way?

Export PostgreSQL Table Data To CSV File


In my previous article I explained about How to import data from .CSV in PostGres table in a simple way? Here I will show how to Export postgres table to .CSV file in a simple way. Execute the below query to export postgres table to .csv file.

Query - Export data to .CSV in PostGres

exporting data, for in postgresql, table to csv ,column table,export data from, an example, simple query



Copy (SELECT tracklocationid, msisdnnumber, lat, lng, createdon
FROM tracklocation 
where msisdnnumber= '9833922076' and lat!='0' 
order by tracklocationid desc) To 'D:/tracklocation.csv' With CSV;


--

Query - Export Postgres table to CSV file with headings


Copy (SELECT tracklocationid, msisdnnumber, lat, lng, createdon
FROM tracklocation 
where msisdnnumber= '9833922076' and lat!='0' 
order by tracklocationid desc) To 'D:/tracklocation.csv' DELIMITER ',' CSV HEADER;



Download the exported sample file from here


How to Export PostGres table to .CSV file in a simple way? Reviewed by Ravi Kumar on 5:56 PM Rating: 5

No comments:

All Rights Reserved by Etechpulse © 2012 - 2017

Contact Form

Name

Email *

Message *

Powered by Blogger.