PostgreSQL資料錶轉換為excel,postgresqlexcel

來源:互聯網
上載者:User

PostgreSQL資料錶轉換為excel,postgresqlexcel

COPY在PostgreSQL表和標準檔案系統檔案之間交換資料。COPYTO把一個表的所有內容都拷貝一個檔案,而COPYFROM一個檔案裡拷貝資料到一個表裡(把資料附加到表中已經存在的內容裡)。

COPY表名TO '檔案名稱.csv' CSV HEADER;

註:CSV

開啟逗號分隔變數(CSV)模式。

HEADER

聲明檔案包含一個頭標識行,包含檔案中每個欄位的名字。輸出時,第一行包含表的欄位名,輸入時,第一行被忽略。


帶檔案名稱的 COPY指示 PostgreSQL伺服器直接從檔案中讀寫資料。如果聲明了檔案名稱,那麼該檔案必須為伺服器可見,而且檔案名稱必須從伺服器的角度聲明。如果聲明的是STDIN或STDOUT,資料通過串連在客戶前端和伺服器之間流動。

http://www.php100.com/manual/PostgreSQL8/sql-copy.html



相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.