Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the use of SQLite's sqlite_ mastery table

Shulou Source: shulou.com Published: 2022-05-31 12:33:15 10月03日 Update

Xiaobian to share with you what SQLite sqlite_master table is used for, I hope you have something to gain after reading this article, let's discuss it together!

SQLite sqlite_master table

The sqlite_master table is a system table for SQLite. This table records table, index, view, and trigger information saved in the database. Each line records one item. This table is automatically created when you create an SQLIte database. The sqlite_master table contains five columns.

The type column records the type of item, such as table, index, view, trigger.

The name column records the name of the item, such as table name, index name, etc.

The tbl_name column records the name of the subordinate table, such as the name of the table where the index is located. For tables, the column is the table name itself.

The rootpage column records the number of items stored in the database page. For views and triggers, this column value is 0 or NULL.

The sql column records the SQL statement that created the item.

Because the sqlite_master table stores all database entries, it can be used to determine whether a particular table, view, or index exists. For example, the following statement determines whether the user table exists.

select count(*) from sqlite_master where name='user' and type='table'

After reading this article, I believe you have a certain understanding of "SQLite sqlite_master table". If you want to know more about it, please pay attention to the industry information channel. Thank you for reading!

Tags: Project data database index view article trigger statement storage one line information can be passed name done that is location time more purpose knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi OPPO Reno Huawei Linux