当前位置:网站首页>System table SQLite of SQLite database_ master

System table SQLite of SQLite database_ master

2022-06-26 18:14:00 yanruo06280

sqlite System table of database sqlite_master

1、 summary

 every last sqlite There is a database called sqlite_master Table of , The schema used to define the database . This table records the information of all tables in the database , For example, the name of the table 、 Used to create this table sql sentence 、 Indexes 、 The table to which the index belongs 、 Creating indexed sql Statement etc. .

2、 The table structure is as follows :
Field name Is the name of all the tables , And for the tables you create , Field type Forever ‘table’

create table sqlite_master(
    type text,
    name text,
    tbl_name text,
    rootpage intger,
    sql text 
    ); 

3、 Common application scenarios
① Query table information

select * from sqlite_master 
where type=tableand name=‘ Table name ’;

② Query index information
If you want to query index information , be type Field is “index”,name The field is the index name , Returns... In the result tbl_name The field is the table to which the index belongs ,sql The field is the... That created this index sql sentence

select * from sqlite_master where type=indexand name=‘ Index name ’;

reference :https://blog.csdn.net/jingcheng345413/article/details/70155254

原网站

版权声明
本文为[yanruo06280]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261806550511.html