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

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

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 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

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.