SQLiteコマンドの使い方
各設定項目に現在設定されている値を表示します
C:\Users\>cd C:\xampp\sqlite
C:\xampp\sqlite>sqlite3 sample.sqlite3
SQLite version 3.8.11.1 2015-07-29 20:00:57
Enter ".help" for usage hints.
1).showコマンド
sqlite> .show
echo: off
eqp: off
explain: off
headers: off
mode: list
nullvalue: ""
output: stdout
colseparator: "|"
rowseparator: "\n"
stats: off
width:
sqlite>
2).modeコマンド
出力モードを設定するために使用する。指定可能な値は次のようなものがある
csv カンマ区切りで出力
column カラム毎に左揃えで出力
html HTMLのTABLE形式で出力
insert INSERT文として出力
line 各カラム毎に行を分けて出力
list 区切り文字でカラムを区切り1行で出力(デフォルト)
tabs タブ区切りで出力
tcl TCLのlist形式で出力
sqlite>.mode list←設定方法
sqlite>select * from staff;
3).separatorマンド
区切り文字として使われる文字を変更します。
sqlite> .show
echo: off
eqp: off
explain: off
headers: off
mode: list
nullvalue: ""
output: stdou
colseparator: "|" ←変更前
rowseparator: "\n"
stats: off
width:
sqlite>.separator ,
sqlite> .show
echo: off
eqp: off
explain: off
headers: off
mode: list
nullvalue: ""
output: stdout
colseparator: "," ←変更後
rowseparator: "\n"
stats: off
width:
4).widthコマンド
データを表示する時のカラム毎の幅を設定します
sqlite>.mode column
sqlite>.width 4
カラムとカラムの間が2文字広がる
5).headersコマンド
ヘッダーが表示させたい時
sqlite>.headers ON
sqlite> .show
echo: off
eqp: off
explain: off
headers: on ←ヘッダが表示される
mode: list
nullvalue: ""
output: stdout
colseparator: ","
rowseparator: "\n"
stats: off
width:
参照サイト→SQLiteコマンドの一覧表
※コメント投稿者のブログIDはブログ作成者のみに通知されます