Getting Started with SQLite on Windows

SQLite is a compact, cross platform, self-contained relational database management system that is available in the public domain.

Tools like RazorSQL have built-in SQLite support. RazorSQL can create new and edit existing SQLite databases even if SQLite is not installed on your Windows system. To download and try RazorSQL, use the Download link in the header at the top of the page. Once downloaded and installed, launch RazorSQL. RazorSQL can create a new SQLite database by going to the Connections -> Add Connection Profile menu option, selecting SQLite as the database type, and then on the next screen, entering the location for the new SQLite database file, etc. You can also connect to existing SQLite databases using RazorSQL.

SQLite also provides a Windows command line program. SQLite needs to be downloaded and installed in order to use the command line program. SQLite can be downloaded from the following:

https://www.sqlite.org/download.html

The file that should be downloaded is the following. The x's in the file name represent the current sqlite version.

sqlite-tools-win32-x86-xxxxxxx.zip

After downloading the above file, unzip it. To launch the sqlite3 command line program, first open a Windows command prompt. The command prompt can be opened by going to the Windows menu and in the search box, type cmd. Click on the Command Prompt application. This will launch a new window. In the new window, we now need to change the directory to where SQLite was unzipped. Below is an example of how to do this assuming sqlite was unzipped at C:\

cd C:\sqlite-tools-win32-x86-3280000\sqlite-tools-win32-x86-3280000

After executing the above command, execute the following command to launch SQLite and create a new database called sample.db:

sqlite3 sample.db

The sample.db file will not be created on disk until we create a table in the database. To create a department table in the database, execute the following command:

create table department (dept_no int, dept_name varchar(50));

After executing the above command, a file named sample.db will be created in the directory where you lauched the sqlite3 command. To insert data into the department table, execute the following command:

insert into department values (1, 'Sales');

To view the data contained in the department table execute the following command:

select * from department;

To exit the command line program, type .quit and then enter.

After exiting the command line program, you can use the following command to connect to your previously created sample.db database:

sqlite3 sample.db

Creating and editing databases is cumbersome using the command line program, so a graphical tool like RazorSQL that is capable of communicating with SQLite makes it much easier to manage your SQLite databases.

RazorSQL is available from here

https://razorsql.com/download.html

With RazorSQL, users can create new or edit existing SQLite databases. It also provides an SQLite browser for showing all tables, views, triggers, etc. and an SQL editor for writing queries and statements to execute against the SQLite database.