🏫 TECH/📚 DB

How to export tables to csv with postgresql psql

팀드모네 2022. 6. 23. 10:35
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!

반응형