红色部分的三条命令完成把结果集输出到文件!!

[root@test root]# psql -hlocalhost -Utest test
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

gudumami=# \f ,
Field separator is ",".
gudumami=# \o /tmp/test.csv
gudumami=# SELECT * WHERE test ORDER BY id;
gudumami=# \q

 

摘自:http://www.cnblogs.com/coffee_cn/articles/1606926.html

红色部分的三条命令完成把结果集输出到文件!!

[root@test root]# psql -hlocalhost -Utest test
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

gudumami=# \f ,
Field separator is ",".
gudumami=# \o /tmp/test.csv
gudumami=# SELECT * WHERE test ORDER BY id;
gudumami=# \q

 

摘自:http://www.cnblogs.com/coffee_cn/articles/1606926.html

相关文章:

  • 2022-01-17
  • 2022-12-23
  • 2022-02-26
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-10-16
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案