SQLiteコマンド解説

SQLiteのコマンドライン プログラムから使用します。
プログラムのファイル名は、バージョン2は[sqlite.exe]、バージョン3は[sqlite3.exe]になります。

書式 説明
.databases
List names and files of attached databases
.dump ?TABLE? ...
テキスト フォーマットでデータベースをダンプする。
.echo ON|OFF
Turn command echo on or off
.exit
Exit this program
.explain ON|OFF
Turn output mode suitable for EXPLAIN on or off.
.header(s) ON|OFF
Turn display of headers on or off
.help
Show this message
.indices TABLE
Show names of all indices on TABLE
.mode MODE
Set mode to one of "line(s)", "column(s)", "insert", "list", or "html"
.mode insert TABLE
Generate SQL insert statements for TABLE
.nullvalue STRING
Print STRING instead of nothing for NULL data
.output FILENAME
Send output to FILENAME
.output stdout
Send output to the screen
.prompt MAIN CONTINUE
Replace the standard prompts
.quit
Exit this program
.read FILENAME
Execute SQL in FILENAME
.schema ?TABLE?
CREATE文を表示する。
.separator STRING
Change separator string for "list" mode
.show
Show the current values for various settings
.tables ?PATTERN?
パターンにマッチするテーブル名を表示する。
.timeout MS
Try opening locked tables for MS milliseconds
.width NUM NUM ...
Set column widths for "column" mode

使用方法

起動時のパラメータで、処理対象のデータベースを指定します。
SQLiteのコマンドライン プログラム

例えば.dumpコマンドを実行すると、次のように出力されます。
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE table1 (field1 numeric, field2 text);
INSERT INTO table1 VALUES(1,'data1');
INSERT INTO table1 VALUES(2,'data2');
COMMIT;