GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python Technologies
  • Databases
  • Computer Programming
  • Web Development
  • Java Technologies
  • Computer Science
  • Mobile Development
  • Big Data & Analytics
  • Microsoft Technologies
  • DevOps
  • Latest Technologies
  • Machine Learning
  • Digital Marketing
  • Software Quality

This view

  • Original page
  • New address

GeezerVison is showing www.tutorialspoint.com — SQLite - Create Database

SQLite Tutorial
  • SQLite - Home
  • SQLite - Overview
  • SQLite - Installation
  • SQLite - Commands
  • SQLite - Syntax
  • SQLite - Data Type
  • SQLite - CREATE Database
  • SQLite - ATTACH Database
  • SQLite - DETACH Database
  • SQLite - CREATE Table
  • SQLite - DROP Table
  • SQLite - INSERT Query
  • SQLite - SELECT Query
  • SQLite - Operators
  • SQLite - Expressions
  • SQLite - WHERE Clause
  • SQLite - AND & OR Clauses
  • SQLite - UPDATE Query
  • SQLite - DELETE Query
  • SQLite - LIKE Clause
  • SQLite - GLOB Clause
  • SQLite - LIMIT Clause
  • SQLite - ORDER By Clause
  • SQLite - GROUP By Clause
  • SQLite - HAVING Clause
  • SQLite - DISTINCT Keyword

SQLite Advanced Concepts

  • SQLite - PRAGMA
  • SQLite - Constraints
  • SQLite - JOINS
  • SQLite - UNION Clause
  • SQLite - NULL Values
  • SQLite - ALIAS Syntax
  • SQLite - Triggers
  • SQLite - Indexes
  • SQLite - INDEXED By Clause
  • SQLite - ALTER Command
  • SQLite - TRUNCATE Command
  • SQLite - Views
  • SQLite - Transactions
  • SQLite - Subqueries
  • SQLite - AUTOINCREMENT
  • SQLite - Injection
  • SQLite - EXPLAIN
  • SQLite - VACUUM
  • SQLite - Date & Time
  • SQLite - Useful Functions

SQLite Interfaces

  • SQLite - C/C++
  • SQLite - Java
  • SQLite - PHP
  • SQLite - Perl
  • SQLite - Python

SQLite Useful Resources

  • SQLite - Quick Guide
  • SQLite - Useful Resources
  • SQLite - Discussion
Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Online Resume Builder
  • HR Interview Questions
  • Computer Glossary
  • Who is Who

SQLite - Create Database



Previous
Quiz
Next

In SQLite, sqlite3 command is used to create a new SQLite database. You do not need to have any special privilege to create a database.

Syntax

Following is the basic syntax of sqlite3 command to create a database: −

$sqlite3 DatabaseName.db

Always, database name should be unique within the RDBMS.

Example

If you want to create a new database <testDB.db>, then SQLITE3 statement would be as follows −

$sqlite3 testDB.db
SQLite version 3.51.1 2025-11-28 17:28:25
Enter ".help" for usage hints.
sqlite>

The above command will create a file testDB.db in the current directory. This file will be used as database by SQLite engine. If you have noticed while creating database, sqlite3 command will provide a sqlite> prompt after creating a database file successfully.

Once a database is created, you can verify it in the list of databases using the following SQLite .databases command.

sqlite>.databases
main: D:\sqlite\testDB.db r/w

You will use SQLite .quit command to come out of the sqlite prompt as follows −

sqlite>.quit
$

The .dump Command

You can use .dump dot command to export complete database in a text file using the following SQLite command at the command prompt.

$sqlite3 testDB.db .dump > testDB.sql

The above command will convert the entire contents of testDB.db database into SQLite statements and dump it into ASCII text file testDB.sql. You can perform restoration from the generated testDB.sql in a simple way as follows −

$sqlite3 testDB.db < testDB.sql

At this moment your database is empty, so you can try above two procedures once you have few tables and data in your database. For now, let's proceed to the next chapter.

Tutorix - AI Tutor
Previous Quiz Next
Advertisements
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.