16

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

Vishal
  • 381
  • 4
  • 19
Mahesh Babu
  • 3,307
  • 9
  • 46
  • 96
  • @MaheshBabu: Jhaliya's answer is correct according to me. So please try that out. – Parth Bhatt Mar 17 '11 at 05:25
  • Possible duplicate of [How to list the tables in an SQLite database file that was opened with ATTACH?](http://stackoverflow.com/questions/82875/how-to-list-the-tables-in-an-sqlite-database-file-that-was-opened-with-attach) – KeksArmee Jan 02 '17 at 04:14

3 Answers3

34

try this :

SELECT * FROM sqlite_master where type='table';
rofrol
  • 13,168
  • 7
  • 73
  • 68
Mitesh Khatri
  • 3,897
  • 4
  • 41
  • 67
8

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?

Community
  • 1
  • 1
Jhaliya - Praveen Sharma
  • 31,542
  • 8
  • 70
  • 75
1

worked for me

    SELECT * FROM sqlite_master where type='table'
M-sAnNan
  • 426
  • 5
  • 15