Installation & Setup

Because SQLite is serverless, "installing" it is nothing like installing MySQL or PostgreSQL — there's no service to configure and no daemon to keep running. For learning and experimenting, all you need is the official sqlite3 command-line tool, which lets you open a database file and type SQL directly at a prompt.

Getting the sqlite3 Command-Line Tool

PlatformHow to get it
macOSShips preinstalled — open Terminal and type sqlite3 to confirm
Most Linux distrosUsually preinstalled, or install via your package manager, e.g. sudo apt install sqlite3
WindowsDownload the precompiled sqlite-tools zip for Windows from sqlite.org/download.html, unzip it, and add the folder to your PATH so sqlite3 works from any terminal

Confirm it's installed by checking the version from a terminal:

sqlite3 --version

Opening (and Creating) a Database

Run sqlite3 followed by a filename to open that database — if the file doesn't already exist, SQLite creates it the moment you actually write something to it:

sqlite3 recipebox.db

You're now inside the SQLite prompt, connected to recipebox.db. From here you can type ordinary SQL:

CREATE TABLE users (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL
);
Note: Nothing about this required a "server install" step — the sqlite3 program itself is the whole database engine, linked directly into that one executable.

Essential Dot-Commands

Lines starting with a dot are commands for the sqlite3 CLI itself, not SQL — they control how the tool behaves rather than querying the database:

.tables            -- list every table in the current database
.schema recipes    -- show the CREATE TABLE statement for one table
.headers on        -- show column names above query results
.mode column        -- print query results as neatly aligned columns
.quit              -- exit the sqlite3 prompt

A typical session turns on friendlier output first, then explores the schema:

.headers on
.mode column
.tables
.schema users

The :memory: Special Filename

Instead of a real filename, you can open a temporary, in-memory database that exists only for the life of the connection and disappears the moment it closes — handy for quick experiments or automated tests where you don't want a file left behind:

sqlite3 :memory:

How Real Applications Use SQLite

The sqlite3 CLI is primarily a learning and exploration tool. Real applications almost always talk to SQLite through a library that embeds the engine directly, rather than shelling out to the CLI:

Language / PlatformTypical way in
PythonThe built-in sqlite3 module — no extra install needed
Node.jsA library such as better-sqlite3
AndroidThe platform's built-in SQLite support, typically used through Room
PHPPDO with the sqlite driver (PDO::__construct('sqlite:recipebox.db'))

Every SQL example in this track works identically whether you run it through the CLI or through one of these libraries — SQL is SQL either way.

Next up: Creating & Opening Databases looks more closely at exactly when and how that .db file comes into existence.