Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of system tables in SQLite

Tags:

sqlite

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 with the sqlite_ prefix and AllDataTypes.

Has anyone done something like this? Is there a list of them?

Thanks in advance.

like image 717
sovanesyan Avatar asked May 18 '10 15:05

sovanesyan


People also ask

How do I get a list of tables in SQLite database?

If you are running the sqlite3 command-line access program you can type ". tables" to get a list of all tables. Or you can type ". schema" to see the complete database schema including all tables and indices.

How do I find the number of tables in SQLite?

int count = cursor. getCount();

How can I see all SQLite databases?

To show all databases in the current connection, you use the . databases command. The . databases command displays at least one database with the name: main .

How many tables are there in SQLite database?

Maximum Number Of Tables In A Join SQLite does not support joins containing more than 64 tables. This limit arises from the fact that the SQLite code generator uses bitmaps with one bit per join-table in the query optimizer.


2 Answers

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 '?'
like image 136
sergio Avatar answered Sep 21 '22 09:09

sergio


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

like image 24
Tanmay Patil Avatar answered Sep 21 '22 09:09

Tanmay Patil