postgresql的数据导入导出
发布时间:2020-12-13 17:08:22 所属栏目:百科 来源:网络整理
导读:命令行链接pgsql pg_test= # h copy Command: COPYDescription: copy data between a file and a tableSyntax:COPY table_name [ ( column_name [, ... ] ) ] FROM { 'filename' | PROGRAM 'command' | STDIN } [ [ WITH ] ( option [, ... ] ) ]COPY { tab
命令行链接pgsqlpg_test=# h copy
Command: COPY
Description: copy data between a file and a table
Syntax:
COPY table_name [ ( column_name [,...] ) ]
FROM { 'filename' | PROGRAM 'command' | STDIN }
[ [ WITH ] ( option [,...] ) ]
COPY { table_name [ ( column_name [,...] ) ] | ( query ) }
TO { 'filename' | PROGRAM 'command' | STDOUT }
[ [ WITH ] ( option [,...] ) ]
where option can be one of:
FORMAT format_name
OIDS [ boolean ]
FREEZE [ boolean ]
DELIMITER 'delimiter_character'
NULL 'null_string'
HEADER [ boolean ]
QUOTE 'quote_character'
ESCAPE 'escape_character'
FORCE_QUOTE { ( column_name [,...] ) | * }
FORCE_NOT_NULL ( column_name [,...] )
FORCE_NULL ( column_name [,...] )
ENCODING 'encoding_name'
导入示例1:copy test.student_info(id,username) from stu_info.csv with DELIMITER ','
导出示例1:copy (select id,username from test.student_info where username != '') to stu_info.csv with delimiter ',' csv header
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |