sqlite_master
CREATE TABLE sqlite_master (
type TEXT,
name TEXT,
tbl_name TEXT,
rootpage INTEGER,
sql TEXT
);
table
For the table, the type
field will always be ‘table’
, name
the field is always the name of the table. Therefore, to obtain a list of all tables in the database, use the following SELECT
statement:
SELECT name FROM sqlite_master
WHERE type=’table’
ORDER BY name;
index
For the index, type
equal to ‘index’
, name
is the name of the index, tbl_name
is the name of the index table belongs. Whether the table or index sql
fields are originally used CREATE TABLE
or CREATE INDEX
statement in which they create a command text. For indexes created automatically (to implement PRIMARY KEY
or UNIQUE
constraints), sql
field NULL
.
Questions
sometimes select name,sql from sqlite_master
and select sql,name from sqlite_master
results are not the same