SQLite FAQ: How to list the tables in a SQLite database

SQLite FAQ: How do I list the tables in a SQLite database?

Solution

To generate a SQLite tables list, just log into your SQLite database with the sqlite3 command, and then issue the tables dot command:

sqlite> .tables

As you can see, the tables list command begins with a dot (decimal), and you also don’t need a semi-colon at the end of the command.

Limiting the SQLite tables list

The SQLite list tables command lists all the tables by default, but if you have a large database and just want to see a subset of the tables in the database, you can pass the tables command the equivalent of a SQL LIKE statement. For instance, in my sample database I see the following tables when I issue the SQLite tables command:

sqlite> .tables
coffees      customers    order_items  orders       salespeople

To limit the output to show only the tables beginning with the string "order", I use this command:

sqlite> .tables 'ord%'
order_items  orders 

Or to see all tables ending with the string "ers", I'd use this list command:

sqlite> .tables '%ers'
customers  orders

If you wanted to see how to create a list of SQLite tables, I hope these “tables” command examples are helpful.