postgreSQL操作整理,即学即用

备份:

pg_dump dbname >dbname.dump

还原:
pg_restore dbname <dbname.dump

连接:
psql dbname

创建数据库:
create database xxxxx;
\q

查询前n行:

select * from table limit n;

导出csv:
copy table to ‘/var/tmp/table.csv’ with csv header;

上一篇
下一篇