Postgresql 导出 csv

在postgresql中想要将查询到的结果导出为csv,采用 copy to的方法。


环境:

postgersql9.6

plsql


核心代码:

copy (select * from test_table) to 'C:/data.csv' (FORMAT 'csv', DELIMITER ',', HEADER true, NULL 'UNKOWN', ENCODING 'UTF8')


help文档地址:https://www.postgresql.org/docs/11/sql-copy.html


原创内容,抄袭必究    

---20190814

---David.Ocean

你可能感兴趣的:(Postgresql 导出 csv)