Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a fast overview over an table structure in SQLite?

Tags:

Is there some command like "show columns from TABLENAME"? I only know that .dump command, but that's really dumb in this case. It puts out all the data, too.

I need something to just see the table structure.

like image 766
Thanks Avatar asked Apr 06 '09 12:04

Thanks


People also ask

How can I see the structure of a table in SQLite?

If you are running the sqlite3 command-line access program you can type ". tables" to get a list of all tables. Or you can type ". schema" to see the complete database schema including all tables and indices.

Does SQLite have a query optimizer?

SQLite provides the ability for advanced programmers to exercise control over the query plan chosen by the optimizer.

What is faster than SQLite?

With Actian Zen, developers and product managers get all the advantages of SQLite but in a powerful, secure, and scalable engine that can run serverless or as a client-server. Actian Zen is orders of magnitude faster than SQLite.


2 Answers

You'll need to use a PRAGMA.

PRAGMA table_info(TABLENAME);

like image 129
DNS Avatar answered Oct 24 '22 18:10

DNS


select * from sqlite_master

should work I think.

like image 40
Mladen Mihajlovic Avatar answered Oct 24 '22 19:10

Mladen Mihajlovic