Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get list of all the tables in sqlite programmatically

Tags:

sqlite

How can I get the list of all the available tables in sqlite programmatically?

like image 568
Mahesh Babu Avatar asked Mar 17 '11 04:03

Mahesh Babu


People also ask

How show all tables in sqlite3 Python?

To list all tables in an SQLite3 database, you should query the sqlite_master table and then use the fetchall() to fetch the results from the SELECT statement. The sqlite_master is the master table in SQLite3, which stores all tables.

How do I find the number of tables in SQLite?

int count = cursor. getCount();

How view SQLite database from command line?

Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.

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.


3 Answers

try this :

SELECT * FROM sqlite_master where type='table';
like image 134
Mitesh Khatri Avatar answered Oct 19 '22 14:10

Mitesh Khatri


Use the below sql statement to get list of all table in sqllite data base

SELECT * FROM dbname.sqlite_master WHERE type='table';

The same question asked before on StackOverFlow.

How to list the tables in an SQLite database file that was opened with ATTACH?

like image 27
Jhaliya - Praveen Sharma Avatar answered Oct 19 '22 15:10

Jhaliya - Praveen Sharma


worked for me

    SELECT * FROM sqlite_master where type='table'
like image 24
M-sAnNan Avatar answered Oct 19 '22 13:10

M-sAnNan