List of system tables in SQLite

前端 未结 3 1186
后悔当初
后悔当初 2020-12-14 21:59

I am trying to filter all the tables in a SQLite database based on if they are system tables or user generated ones.

So far I\'ve found out that they are the ones wi

相关标签:
3条回答
  • 2020-12-14 22:34

    There is only one system table that is of any consequence.

    select * from sqlite_master
    

    but you may get some useful information from sqlite_sequence,

    0 讨论(0)
  • 2020-12-14 22:37

    I think it can be filtered by name (as you already done)

    I've used script

    SELECT 
      name, type
    FROM 
      sqlite_master
    WHERE 
      type in ('table', 'view')
    AND 
      name not like 'sqlite?_%' escape '?'
    
    0 讨论(0)
  • 2020-12-14 22:40

    sqlite_autoindex_TABLE_N - which will have information UNIQUE and PRIMARY KEY constraints on ordinary table.

    sqlite_statN - which will have where N is an integer. Such tables store database statistics gathered by the ANALYZE command and used by the query planner to help determine the best algorithm to use for each query.

    Source : https://www.sqlite.org/fileformat2.html

    sqlite_user - this table will be present ,if we set up authentication-required database.

    Source : http://www.sqlite.org/src/doc/trunk/ext/userauth/user-auth.txt

    0 讨论(0)
提交回复
热议问题