- Mastering PostgreSQL 12
- Hans Jürgen Sch?nig
- 99字
- 2021-08-20 10:00:19
Displaying output as CSV
For those of you using psql to work with PostgreSQL, there is more—psql can't display data in CSV format, as shown in the next listing:
test=# \pset format csv
Output format is csv.
test=# SELECT id, id FROM generate_series(1, 4) AS id;
id,id
1,1
2,2
3,3
4,4
This is especially useful if you are using psql in a shell script and if you are piping data from one program to the next. If you always want to get data in CSV format, you can add the pset command to your .psqlrc file.
推薦閱讀
- 大數(shù)據(jù)戰(zhàn)爭(zhēng):人工智能時(shí)代不能不說的事
- 協(xié)作機(jī)器人技術(shù)及應(yīng)用
- 并行數(shù)據(jù)挖掘及性能優(yōu)化:關(guān)聯(lián)規(guī)則與數(shù)據(jù)相關(guān)性分析
- CSS全程指南
- Android游戲開發(fā)案例與關(guān)鍵技術(shù)
- 水下無線傳感器網(wǎng)絡(luò)的通信與決策技術(shù)
- 云原生架構(gòu)進(jìn)階實(shí)戰(zhàn)
- 在實(shí)戰(zhàn)中成長(zhǎng):Windows Forms開發(fā)之路
- 精通數(shù)據(jù)科學(xué):從線性回歸到深度學(xué)習(xí)
- Unity Multiplayer Games
- 機(jī)器人人工智能
- 自適應(yīng)學(xué)習(xí):人工智能時(shí)代的教育革命
- FANUC工業(yè)機(jī)器人虛擬仿真教程
- 歐姆龍PLC應(yīng)用系統(tǒng)設(shè)計(jì)實(shí)例精解
- 工程地質(zhì)地學(xué)信息遙感自動(dòng)提取技術(shù)