Lesson 1- Environment Setup and Creating a Database

Though there are several database management systems such as MySQL, MS SQL Server, PostgreSQL etc, that support SQL language. However, we will be using SQLite, which one of the easiest databases to work with. Let’s first install the SQLite Database.

Installing SQL Lite

Installing SQLite Binaries

To download SQLite, the first step is to go to the download page: https://www.sqlite.org/download.html. In the section for “Precompiled Binaries for Windows”, click the third option i.e. “sqlite-tools-win32-x86-3290000.zip” as shown in the figure below:

The installation process is straight forward. Create a folder named “sqlite” anywhere on your file system. I created it in E:\sqlite. Unzip the precompiled binaries that you downloaded inside the “E:sqlite” folder. Your folder should now contain the following three files:

Next, you simply have to navigate to “E:\sqlite” folder using the command line tool and execute the command “sqlite3”. You should see the following output:

If you see the above output, that means you have successfully installed SQLite. Though we can execute SQLite queries from the command line, we will use a GUI based tool to execute our SQL queries on SQLite.

Creating a Database

A database can be considered as the top-level entity that stores your data. A database has several columns and the data is actually stored inside the table which we will see in the next chapter.

We will be creating a database for a retail store that sells electronic items such as laptops, mobiles, computers, PlayStation etc. The name of our database will be “RetailDB”. To create a new database, open command line, navigate to the “E:\sqlite” folder where you downloaded your SQLite binaries and execute the following command:

E:\sqlite>sqlite3 RetailDB.db

Once you execute the above command, you will see database named “RetailDB.db” in the “E:\sqlite” directory.

Installing DB Browser for SQLite

DB Browser is a GUI tool that can be easily used to connect and execute queries on SQLite databases. To download DB Browser for SQLite, please go the link and select the relevant version: https://sqlitebrowser.org/dl/ . I am downloading the standard installer for 64-bit windows. Once the installer is downloaded, open the installer and run it. An installation window will open. Simply accept the agreement and then keeping clicking next. Make sure that you check the following options while installation.

The setup will hardly take seconds to complete.

Once the setup is complete, open DB Browser for SQLite and then click on “Open Databases”. Navigate to the folder where you created “RetailDB” and select it as shown in the following figure:

What’s Next?

In this lesson, you saw how to set up the environment to run SQLite database. You also saw how to create a Database in SQLite. In the next lesson, you will see how to create tables inside an SQLite database.