Sunday, September 23, 2012

SQLite Command Line Syntax

For Android development, SQLite3 is the default database that comes with the Android OS. As such, it's a good idea to know some of the basic commands. We decided to keep them here for a handy reference. Leave us a Comment if we missed something you'd like us to include.

The ADB prompt looks like this. 
#
 
The sqlite3 prompt looks like this.
sqlite>


To connect to a database:
     # sqlite3 databasename.db

To list ALL tables in a database:
          sqlite> .tables
     list ALL tables with names like 'foo' in a database:
          sqlite> .tables foo

To show the create commands used to create the tables:
          sqlite> .schema
     show the create commands used to create a table foo:
          sqlite> .schema foo


To set column widths for output:
     sqlite> .width col_width1 col_width2 col_width3 ...


No comments:

Post a Comment