欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

PG COPY导入导出数据

程序员文章站 2024-01-17 22:06:34
...

导出

实例1

/home/postgres/pgsql/bin/psql -U postgres -c "copy(select datname from pg_database where datname not in ('postgres','template0','template1','zabbix') order by datname) to '/home/postgres/pgsql/databasejudgetmp.txt'" 

实例2

COPY products
TO '/path/to/output.csv'
WITH csv;

实例3

COPY (
  SELECT name, category_name
  FROM products
  LEFT JOIN categories ON categories.id = products.category_id
)
TO '/path/to/output.csv'
WITH csv;

导入

实例1

COPY products
FROM '/path/to/input.csv'
WITH csv;
相关标签: COPY

上一篇: MATLAB画动态图,movie

下一篇: