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;
上一篇: MATLAB画动态图,movie