SQLite
公式サイトへのリンク
- Documentation
- SQL As Understood By SQLite
- Documentation -> Programing Interface -> SQL Syntax
- SQL As Understood By SQLite
起動
sqlite3 ${DBファイルパス}
テーブル作成
create table username(id integer primary key autoincrement, name text);
参考
insert
--autoincrementしている場合、idは不要。
insert into username (id, name) values (1, 'hoge');
終了
sqlite> .quit
外部ファイルを実行する
sqlite3コマンドを使う
sqlite3 ${SQLiteファイルパス} < ${SQLパス}
sqlite3起動後に使う
.read ${SQLパス}
csvインポート
.mode csv
.import ${CSVファイルパス} ${インポート対象テーブル}
テーブル定義確認
.schema ${テーブル名}