새소식

DB

How to export tables to csv with postgresql psql

  • -
728x90

 

1. Access psql

$psql -U postgres user

Explanation) Accessing a database called user with a postgres account

 

2. Enter the copy command for csv extraction

$COPY (SELECT* FROM test) TO 'D:\test.csv' With CSV DELIMITER ',';

Explanation) Store the data in the table called test on the D drive in CSV format

Have a good day!

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.