| カラム名 | 型 | 説明 |
|---|---|---|
type |
TEXT |
The sqlite_schema.type column will be one of the following text strings: 'table', 'index', 'view', or 'trigger' according to the type of object defined. The 'table' string is used for both ordinary and virtual tables. |
name |
TEXT |
The sqlite_schema.name column will hold the name of the object. UNIQUE and PRIMARY KEY constraints on tables cause SQLite to create internal indexes with names of the form "sqlite_autoindex_TABLE_N" where TABLE is replaced by the name of the table that contains the constraint and N is an integer beginning with 1 and increasing by one with each constraint seen in the table definition. In a WITHOUT ROWID table, there is no sqlite_schema entry for the PRIMARY KEY, but the "sqlite_autoindex_TABLE_N" name is set aside for the PRIMARY KEY as if the sqlite_schema entry did exist. This will affect the numbering of subsequent UNIQUE constraints. The "sqlite_autoindex_TABLE_N" name is never allocated for an INTEGER PRIMARY KEY, either in rowid tables or WITHOUT ROWID tables. |
tbl_name |
TEXT |
The sqlite_schema.tbl_name column holds the name of a table or view that the object is associated with. For a table or view, the tbl_name column is a copy of the name column. For an index, the tbl_name is the name of the table that is indexed. For a trigger, the tbl_name column stores the name of the table or view that causes the trigger to fire. |
rootpage |
INTEGER |
The sqlite_schema.rootpage column stores the page number of the root b-tree page for tables and indexes. For rows that define views, triggers, and virtual tables, the rootpage column is 0 or NULL. |
sql |
TEXT |
The sqlite_schema.sql column stores SQL text that describes the object. This SQL text is a CREATE TABLE, CREATE VIRTUAL TABLE, CREATE INDEX, CREATE VIEW, or CREATE TRIGGER statement that if evaluated against the database file when it is the main database of a database connection would recreate the object. |
SELECT * FROM sqlite_schema;SELECT type, name, tbl_name, rootpage, sql FROM sqlite_schema;| カラム名 | 型 | 説明 |
|---|---|---|
key |
TEXT |
※PK |
value |
TEXT |
SELECT * FROM sqlite_parameters;SELECT key, value FROM sqlite_parameters;| カラム名 | 型 | 説明 |
|---|---|---|
schema |
TEXT |
|
name |
TEXT |
|
type |
TEXT |
|
ncol |
INTEGER |
|
wr |
INTEGER |
|
strict |
INTEGER |
PRAGMA table_list;SELECT * FROM pragma_table_list;SELECT schema, name, type, ncol, wr, strict FROM pragma_table_list;T.B.D.
PRAGMA collation_list;SELECT * FROM pragma_collation_list;SELECT seq, name FROM pragma_collation_list;T.B.D.
PRAGMA database_list;SELECT * FROM pragma_database_list;SELECT seq, name, file FROM pragma_database_list;T.B.D.
PRAGMA foreign_key_list(テーブル名);SELECT * FROM pragma_foreign_key_list(@table_name);SELECT id, seq, "table", "from", "to", on_update, on_delete, match FROM pragma_foreign_key_list(@table_name);@table_nameはTEXT型でテーブル名- PRAMGA文ではパラメータ使用不可
T.B.D.
PRAGMA function_list;SELECT * FROM pragma_function_list;SELECT name, builtin, type, enc, narg, flags FROM pragma_function_list;| カラム名 | 型 | 説明 |
|---|---|---|
seq |
INTEGER |
A sequence number assigned to each index for internal tracking purposes. |
name |
TEXT |
The name of the index. |
unique |
INTEGER |
"1" if the index is UNIQUE and "0" if not. |
origin |
TEXT |
"c" if the index was created by a CREATE INDEX statement, "u" if the index was created by a UNIQUE constraint, or "pk" if the index was created by a PRIMARY KEY constraint. |
partial |
INTEGER |
"1" if the index is a partial index and "0" if not. |
PRAGMA table_list(テーブル名);SELECT * FROM pragma_table_list(@table_name);SELECT seq, name, "unique", origin, partial FROM pragma_table_list(@table_name);@table_nameはTEXT型でテーブル名- PRAMGA文ではパラメータ使用不可
T.B.D.
PRAGMA module_list;SELECT * FROM pragma_module_list;SELECT name FROM pragma_module_list;T.B.D.
PRAGMA pragma_list;SELECT * FROM pragma_pragma_list;SELECT name FROM pragma_pragma_list;| カラム名 | 型 | 説明 |
|---|---|---|
cid |
INTEGER |
|
name |
TEXT |
|
type |
TEXT |
|
notnull |
INTEGER |
|
dflt_value |
ANY |
|
pk |
INTEGER |
PRAGMA table_info(テーブル名);SELECT * FROM pragma_table_info(@table_name);SELECT cid, name, type, "notnull", dflt_value, pk FROM pragma_table_info(@table_name);@table_nameはTEXT型でテーブル名- PRAMGA文ではパラメータ使用不可
| カラム名 | 型 | 説明 |
|---|---|---|
cid |
INTEGER |
|
name |
TEXT |
|
type |
TEXT |
|
notnull |
INTEGER |
|
dflt_value |
ANY |
|
pk |
INTEGER |
|
hiddne |
INTEGER |
PRAGMA table_xinfo(テーブル名);SELECT * FROM pragma_table_xinfo(@table_name);SELECT cid, name, type, "notnull", dflt_value, pk, hidden FROM pragma_table_xinfo(@table_name);@table_nameはTEXT型でテーブル名- PRAMGA文ではパラメータ使用不可
| カラム名 | 型 | 説明 |
|---|---|---|
seqno |
INTEGER |
The rank of the column within the index. (0 means left-most.) |
cid |
INTEGER |
The rank of the column within the table being indexed. A value of -1 means rowid and a value of -2 means that an expression is being used. |
name |
TEXT |
The name of the column being indexed. This columns is NULL if the column is the rowid or an expression. |
PRAGMA index_info(インデックス名);SELECT * pragma_index_info(@index_name);SELECT seqno, cid, name FROM pragma_index_info(@index_name);@index_nameはTEXT型でインデックス名- PRAMGA文ではパラメータ使用不可
| カラム名 | 型 | 説明 |
|---|---|---|
seqno |
INTEGER |
The rank of the column within the index. (0 means left-most. Key columns come before auxiliary columns.) |
cid |
INTEGER |
The rank of the column within the table being indexed, or -1 if the index-column is the rowid of the table being indexed and -2 if the index is on an expression. |
name |
TEXT |
The name of the column being indexed, or NULL if the index-column is the rowid of the table being indexed or an expression. |
desc |
INTEGER |
1 if the index-column is sorted in reverse (DESC) order by the index and 0 otherwise. |
coll |
TEXT |
The name for the collating sequence used to compare values in the index-column. |
key |
INTEGER |
1 if the index-column is a key column and 0 if the index-column is an auxiliary column. |
PRAGMA index_xinfo(インデックス名);SELECT * pragma_index_xinfo(@index_name);SELECT seqno, cid, name, desc, coll, key FROM pragma_index_xinfo(@index_name);@index_nameはTEXT型でインデックス名- PRAMGA文ではパラメータ使用不可
SQLのバイトコードを取得する.
他のRDBMSと違い,実行計画の取得でないことに注意.
実行計画の取得は EXPLAIN QUERY PLAN である.
sqlite3コマンドでは特殊扱いで,通常のクエリと異なった整形表示であるが,ライブラリ等を経由して実行すると,クエリのような結果が得られる.
| カラム名 | 型 | 説明 |
|---|---|---|
addr |
INTEGER |
|
opcode |
TEXT |
|
p1 |
INTEGER |
|
p2 |
INTEGER |
|
p3 |
INTEGER |
|
p4 |
TEXT |
|
p5 |
INTEGER |
|
comment |
COMMENT |
EXPLAIN [SQL文];- サブクエリ等への利用は不可
SQLの実行計画を取得する.
sqlite3コマンドでは特殊扱いで,通常のクエリと異なったツリー形式の整形表示であるが,ライブラリ等を経由して実行すると,クエリのような結果が得られる.
| カラム名 | 型 | 説明 |
|---|---|---|
id |
INTEGER |
|
parent |
INTEGER |
|
notused |
INTEGER |
|
detail |
TEXT |
EXPLAIN QUERY PLAN [SQL文];- サブクエリ等への利用は不可