同時実行制御

URL: https://www.kkaneko.jp/data/dataset/10.html https://www.sqlite.org/lockingv3.html

トランザクション

トランザクション

https://www.sqlite.org/rtree.html https://www.sqlite.org/fileformat.html The following three declarations all cause the column "x" be an alias for the rowid: create table t(x integer primary key ASC, y, z); create table t(x integer, y, z, primary key(x ASC)); create table t(x integer, y, z, primary key(x DESC)); But, in contrast, the following declaration does not result in "x" being an alias for the rowid: create table t(x integer primary key DESC, y, z); PRAGMA encoding = "UTF-8";

.mode による出力モードの切り替え

主な出力モードは次の通りです

.output による実行結果のファイル出力

SQL の実行結果をファイルに出力するには,「.output」を使う.

 

テーブルの一覧表示

データベース内のテーブル一覧を表示するには,sqlite_maste, sqlite_temp_masteという名前が付いた特別なテーブルを使う.

データベーススキーマを見たいときは,次のような操作を行う.

select * from sqlite_master;
select * from sqlite_temp_master;

* sqlite_master, sqlite_temp_master に,DROP TABLE, UPDATE, INSERT, DELETE 操作を行うことは許されていません

テーブルごとのインデックス名の表示

.indices」コマンドを使い,インデックス名を表示できる. 次のように,テーブル名を指定して使う.

.indices commodity
 

テーブルのテキストファイル形式でのダンプとリストア

.dump を使い,データベースのダンプ.特定のテーブルだけをダンプしたいときは,「.dump commodity」のようにする

単にダンプを実行すると,スクリーンにダンプ結果が出力される.

ダンプ結果をファイルに保存したいときは,先に「.output <ファイル名>」を実行する.

ファイルに保存されたダンプ結果をリストアしたいときは,「.read ファイル名」を実行する.

.iotrace による I/O 診断ログの記録

「.iotrace <ファイル名>」により, I/O 診断ログが指定したファイルに記録される. File と path の例. Path を別テーブル FOREIGN KEY constraints are parsed but are not enforced. However, the equivalent constraint enforcement can be achieved using triggers. The SQLite source tree contains source code and documentation for a C program (genfkey) that will read an SQLite database, analyze the foreign key constraints, and generate appropriate triggers automatically. PRAGMA foreign_keys; PRAGMA foreign_keys = boolean; sqlite> PRAGMA foreign_keys; 0 sqlite> PRAGMA foreign_keys = ON; sqlite> PRAGMA foreign_keys; 1 sqlite> PRAGMA foreign_keys = OFF; sqlite> PRAGMA foreign_keys; 0



URL: https://www.kkaneko.jp/data/dataset/9.html If you have a backup copy of your database file, recover the information from your backup.

Sqliteman を用いた二次索引の除去

二次索引がないときと,二次索引があるときの SQL 問い合わせ計画を見たいので, 下記の手順で,zips テーブルの二次索引を確認し,二次索引を全て削除する. (Inspect a secondary index of table 'zips' and delete all secondary indices of the table).


  • DROP INDEX を用いた二次索引の削除 (remove the secondary index using 'DROP INDEX')

    DROP INDEX idx2;