About sqlite system tables sqlite_master

sqlite_master

CREATE TABLE sqlite_master ( 
type TEXT, 
name TEXT, 
tbl_name TEXT, 
rootpage INTEGER, 
sql TEXT 
); 

table

For the table, the typefield will always be ‘table’, namethe field is always the name of the table. Therefore, to obtain a list of all tables in the database, use the following SELECTstatement:

SELECT name FROM sqlite_master 
WHERE type=tableORDER BY name; 

index

For the index, typeequal to ‘index’, nameis the name of the index, tbl_nameis the name of the index table belongs. Whether the table or index sqlfields are originally used CREATE TABLEor CREATE INDEXstatement in which they create a command text. For indexes created automatically (to implement PRIMARY KEYor UNIQUEconstraints), sqlfield NULL.

Questions
sometimes select name,sql from sqlite_masterand select sql,name from sqlite_masterresults are not the same

Published 47 original articles · won praise 2 · Views 3166

Guess you like

Origin blog.csdn.net/a3320315/article/details/101405105