1

I have a sqlite file but I don't know what tables there are in it and thus I can't use a SELECT query.

So, is there a way to know what table are in it ?

P.S. I am under Ubuntu Linux and I have already installed sqlite3 from shell.

1 Answer 1

3

You can open the database using sqlite3 using:

sqlite3 <databasefile>

Once in the sqlite3 shell you can simply type:

.tables

to see a list of all the tables.

You can see the table structure of a particular table using:

.schema <tablename>

You can also omit the table name to see the schema for the whole database.

Information about these commands and more can be seen by typing:

.help
Sign up to request clarification or add additional context in comments.

2 Comments

I get this: sqlite> .tables Error: file is encrypted or is not a database
What does file databasefile say in your shell (not in sqlite)? It should say something like "SQLite 3.x database" if it is an SQLite database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.