Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve a list of all tables in the database

Tags:

android

sqlite

I have this database file under the usual databases folder and a bunch of tables inside it.

Please note that I don't want to retrieve under the command line. I know I can use the ".tables" command.

I want to retrieve a list of all tables in it, using code, so that I can execute some specific algorithms on each of them.

Also, I didn't find any questions with this problem on Android, so please forgive me if there is any. I was wondering if there is any function I can use under DatabaseUtils, but I didn't find any either.

like image 298
davidcesarino Avatar asked Nov 10 '10 05:11

davidcesarino


People also ask

Which command is used to display list of all tables in the databases?

The SHOW TABLES command is used to display the table names in a database as well as the server.


1 Answers

Use

select name from sqlite_master where type = 'table'
like image 50
Diego Torres Milano Avatar answered Oct 07 '22 21:10

Diego Torres Milano