SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.

This library provides the capability to add an embedded and complete RDBMS into your application, an interactive command line tool is also provided with the library. With this tool you can do almost every thing you need to do on adb.

1 How do I create a new db?

from the command line issue the following command:

# sqlite3 mydb.db

at this point the sqlite3 interactive interface will be running and you will see a prompt like the following

sqlite> 


2 How do I create a new table?

In the sqlite prompt type the following command:

sqlite> create table testtable(text, INTEGER);


3 How do I list all tables?

In the sqlite3 command-line access program type ".tables" to get a list of all tables. 

sqlite> .tables

testtable


4 How do I list the schema of an SQLite database?

In the sqlite3 command-line access program type ".schema" to get a list of all tables. 

sqlite> .schema

CREATE TABLE testtable(text, INTEGER);


 

5 How do I add a new record to a database?

In the sqlite3 command-line access program type an INSERT command like the following:

sqlite> insert into testtable values('first text', 1);


6 How do I show the content of a table?

In the sqlite3 command-line access program type a select command like the following:

sqlite> select * from testtable;

first text|1

sqlite> 


7 How do I remove a table from an sqlite database?

In the sqlite3 command-line access program type a DROP command like the following:

sqlite> drop table testtable;

sqlite> .schema

sqlite> 


8 How do I remove a row from an sqlite table?

In the sqlite3 command-line access program type a delete command like the following:

sqlite> delete from testtable where INTEGER=1;

sqlite> select * from testtable;

sqlite> 


9 What datatypes does SQLite support?

Content can be stored as INTEGER, REAL, TEXT, BLOB, or as NULL.


10 Can I use SQLite in my commercial product without paying royalties?

Yes. SQLite is in the public domain. No claim of ownership is made to any part of the code. You can do anything you want with it.

 
Gg1