psql数据导出导入 {COPY}

--进入数据库使用copy 导出数据为表格--

1. 例子1
\COPY (SELECT U.user_name,U.user_pass,,A.agents_name,U.qq,,H.pay_card,H.pay_num,H.pay_name 
FROM user_list AS U LEFT JOIN history_bank AS H ON = H.uid LEFT JOIN agents_list AS A ON to '/tmp/beifen.csv' with csv header;

2. 例子2

\COPY (select * from user_list) to '/user_list.csv' with csv header;

此种方式导出为csv 格式如需要 Excel 请使用 wps 自行转换

3. 例子3
\COPY (select * from easy_lot_result where lot_id=10902 and opentime>='2019-07-27 00:00:00' order by 
id asc) to '/tmp/1.sql' ;
4. 列子4
\copy (select * from live_order where live_username = 'amyaa785378959') to '/home/rose/1.sql';
delete from live_order where  live_username = 'amyaa785378959';
\copy live_order from '/home/rose/1.sql';




已有 6 条评论

  1. Updalay

    The black bean rice was clenched into a ball, just the size of a bite, and then stuffed into their mouths and chewed quickly cheap cialis from india