A SMALL DATABASE. A USEFUL FIRST STEP.

Get started with SQLite

Choose the browser for a quick experiment, or the command-line shell for working with a local database file. Start with a tiny table so every result is easy to understand.

SQLite, sqlite3 and SQL

SQL is the language you use to describe queries. SQLite is a database engine that runs inside an application. The sqlite3 command-line program opens SQLite databases in a terminal. Python also names its SQLite interface sqlite3; it is a module, not the terminal program.

Choose your starting point

  1. No installation: open the sample above, edit a query and choose Run query. Files remain in your browser.
  2. Existing file: open an unencrypted .sqlite or .db file. Select a table to browse rows.
  3. Local terminal: follow the platform steps below, then run the first-database example.

SQLite on Windows

On the official download page, choose the SQLite tools archive matching your Windows architecture. Extract it to a folder. Open PowerShell in that folder and run the executable directly; adding the folder to PATH is optional.

.\sqlite3.exe --version
.\sqlite3.exe learning.db

SQLite on Mac

Open Terminal and check whether the shell is available. If it is missing or you need a different version, use the official macOS tools download matching your processor. Run the extracted executable from its folder.

sqlite3 --version
# From an extracted tools folder:
./sqlite3 learning.db

SQLite on Linux

Check for sqlite3 first. If missing, install your distribution's SQLite command-line package using its package manager, or use a compatible Linux tools archive from the official downloads. Package names and versions vary by distribution.

sqlite3 --version
sqlite3 learning.db

Create, insert, query

After the shell opens learning.db, enter this SQL. You can also paste it into a new SQLite Lab workspace. Use a fresh database or change the table name when repeating it.

CREATE TABLE reading_list (
  id INTEGER PRIMARY KEY,
  title TEXT NOT NULL,
  finished INTEGER NOT NULL DEFAULT 0
);
INSERT INTO reading_list (title) VALUES ('Learn SQLite');
SELECT id, title, finished FROM reading_list;

You should see one row with id 1 and finished 0. In the terminal shell, use .quit to exit. Dot commands belong to the shell and are not SQL; do not paste them into the browser editor.

Keep your work

The terminal stores learning.db in your current folder. In SQLite Lab, download your database using Export database. Browser storage may be cleared, so keep a separate backup of work you need.

Planning a larger dataset? Read about SQLite file, row and memory limitsbefore choosing an import or export workflow.

What to learn next

Official shell documentation · Official downloads

HELPFUL ANSWERS

Frequently asked questions

Clear answers to common questions about this topic.

Is SQLite similar to SQL?

SQL is a language for querying and changing relational data; SQLite is a database engine that understands its own SQL dialect. They are related but not interchangeable terms. Learn core SELECT, INSERT, UPDATE and JOIN syntax first, then check SQLite-specific functions, types and PRAGMA statements when moving between engines.

What is SQL vs SQLite?

SQL is the language used to describe database operations. SQLite is software that stores data and executes SQL statements, usually against a local database file. Other engines such as PostgreSQL and MySQL also use SQL, but differ in features, functions, types and deployment. A SQL query may need changes when moved between them.

How do I start SQLite?

For a first experiment, open the SQLite Lab sample and run SELECT sqlite_version(); or create a scratch table in the workspace. For local terminal use, install the official sqlite3 shell, run sqlite3 my.db, then enter SQL terminated by a semicolon. The shell creates the database file when needed; keep a backup before modifying important data.

Do I need to install SQLite?

It depends on how you use it. SQLite Lab runs in a browser without a local install, and many applications include the SQLite library already. To use the sqlite3 terminal command, install the official command-line tools if they are not present. Python commonly includes the sqlite3 module, though individual Python builds can omit it.

Do we need to install SQLite?

No installation is needed to try SQLite in this browser workspace or in software that bundles the engine. You do need an SQLite library or command-line program somewhere to use it outside those environments. Check your Python build with python -c "import sqlite3; print(sqlite3.sqlite_version)" before downloading anything extra.

Is SQLite offline?

Yes. SQLite itself reads and writes local storage without a network or database server. SQLite Lab can run queries after its website assets have loaded, but a first visit or uncached assets still require access to the site; it is not advertised as a fully installable offline web app. Back up files you want to keep.

Is SQLite a file or a database?

SQLite is a database engine, while a persistent SQLite database is commonly stored in a single main file. The file holds tables, indexes and records, and SQLite may create temporary journal or WAL sidecar files during transactions. SQLite can also use an in-memory database with no persistent file.

What type of file is SQLite?

A typical SQLite database is a binary file with the SQLite database format, often named .db, .sqlite or .sqlite3. The extension alone does not prove a file is SQLite; other products use .db too. Open an unencrypted file with SQLite-compatible software and let the engine validate its header and structure.

What app opens SQLite?

The official sqlite3 command-line shell opens SQLite database files. Browser tools such as SQLite Lab and desktop SQLite database browsers can also inspect ordinary unencrypted .db, .sqlite and .sqlite3 files. If the file is encrypted or belongs to an application with a private schema, use that application’s supported export or access method.

Does SQLite run in memory?

Yes. Opening the special filename :memory: creates a database held in the process’s memory, useful for tests and temporary work. It disappears when its connection closes unless you use a supported shared-memory arrangement. For durable data, use a file-backed database and maintain backups.

How can I build my own SQLite database?

Create a new database in SQLite Lab or open sqlite3 my.db in the official shell. Define tables with CREATE TABLE, insert sample rows with INSERT, then query them with SELECT. Add primary keys and constraints early, test your queries, and export or back up the file. The getting-started example above walks through a small first table.