I'm using sqlite manager extension in chrome to use sqlite database.I have a sqlite database.This extension works properly with select delete alter commands.but the problem is i can't list tables of database.is there any way to do this?.
Asked
Active
Viewed 304 times
-1
-
You should search SO before posting a question. This question had been asked and answered a number of time already. Two examples: [link](https://stackoverflow.com/questions/5334882/how-to-get-list-of-all-the-tables-in-sqlite-programmatically) and [link](https://stackoverflow.com/questions/82875/how-to-list-the-tables-in-a-sqlite-database-file-that-was-opened-with-attach) – Pay it forward Oct 12 '20 at 19:18
1 Answers
1
You have not said what extension you are running for SO members to be able to offer definitive help.
Having said that, if you say can run SELECT queries, try:
SELECT * FROM sqlite_master WHERE type='table'
If you want only the table name, without schema details, try:
SELECT name FROM sqlite_master WHERE type='table';
Examples, including table creation
/* Create 3 table */
CREATE TABLE Your_First_Table (Id integer PRIMARY KEY, Address text);
CREATE TABLE Your_Second_Table (Id integer PRIMARY KEY, Price text);
CREATE TABLE Your_third_Table (Id integer PRIMARY KEY, Stats text);
/*Get table names and schema details */
SELECT * FROM sqlite_master WHERE type='table';
/*Get table names */
SELECT name FROM sqlite_master WHERE type='table';
Output from 1st Select:
table|Your_First_Table|Your_First_Table|2|CREATE TABLE Your_First_Table (Id integer PRIMARY KEY, Address text)
table|Your_Second_Table|Your_Second_Table|3|CREATE TABLE Your_Second_Table (Id integer PRIMARY KEY, Price text)
table|Your_third_Table|Your_third_Table|4|CREATE TABLE Your_third_Table (Id integer PRIMARY KEY, Stats text)
Output from 2nd Select:
Your_First_Table
Your_Second_Table
Your_third_Table

Pay it forward
- 461
- 5
- 11