Generating SQLite database using sqlite3

sqlite3 is simple command line utility. After running with command line, user can create the database file with preferred name. Then user can use SQL command to manage the database.

Installing

Download link: http://www.sqlite.org/download.html
Eg: For Windows user, use the following “Precompiled Binaries For Windows” link.

1. Download is a compressed file.  After extract it and select the sqlite3.exe file inside the extracted directory. Then save it.

Eg: I used directory “sqlite” inside the C partition:
C:\sqlite

2. Open the command prompt and goto to the derectory

Eg: command
cd c:\sqlite

Creating Database

1. Enter command “sqlite3 <database_file_name>”.

Eg: Following command to create the helloworld database
sqlite3 HelloWorld.db

2. Then command prompt will show as following.

SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

3. Then use the SQL command to create the tables and populating tables.

Eg: SQL command to create a table
sqlite>create table tbl1(one varchar(10), two smallint);

4. After completed data insertion, use “.exit” command to exit the sqlite3.

Eg: Command
sqlite> .exit

For more information, please refer http://www.sqlite.org/sqlite.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s