Create a New SQLite Database
Overview
Let’s learn the steps to create a new SQLite Database. SQLite is a software library that provides a relational database management system. It is known for its simplicity and lightweight nature, as it is a self-contained, serverless, zero-configuration, and transactional SQL database engine.
New SQLite Database
We can create a new SQLite database using the following ways:
- By using SQLite command-line interface (CLI).
- By using SQLite GUI tool(DB Browser for SQLite).
- By using Python Script ( Automation )
This guide will show you how to create a new SQLite database using the command-line interface and DB Browser for the SQLite GUI tool.
Using Command-line
Open a Windows command prompt.
Navigate to the directory where you want to create the database.
We can use the cd change directory command.
cd /path/to/create/database
Run the following command to open the SQLite prompt and create a new database. Replace “database_name” with the desired name of your database file.
/> sqlite3 database_name.db
For example, to create a database called world.db, run the following command:
/> sqlite3 world.db
Using DB Browser
In this example, we will create a new SQLite database file named “world.db”. The steps to create the database are as follows:
Launch the DB browser tool. Double-click on the desktop icon to launch it.
Click on the New Database tab.
After clicking on the New Database tab, you will be prompted to enter a name for the database. Enter the database name and click on the Save button to proceed.
An empty database will be created, and you will be prompted to create a table under that database.
That’s it. We’ve now successfully created a new SQLite database.
Official Website
For more information on DB Browser for SQLite tool:
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/
For more information on SQLite, visit the official website: